Lee (4-2) stymied the Diamondbacks on six hits in the 114-pitch performance, walking two and striking out three en route to his second win in two starts.
He left with a 3-0 lead but reliever Anthony Bastardo walked Arizona's A.J. Pollock and allowed a single to Paul Goldschmidt with one out in the eighth.
The Phillies closer also had to work out of a jam in the ninth after Gerardo Parra singled and Eric Chavez doubled with one out. But he racked up his sixth save by fanning Eric Hinske and Pollock in succession.
Jimmy Rollins knocked in two runs as Philadelphia notched its first win in a four-game series.
Diamondbacks starter Trevor Cahill (2-4) took the loss despite yielding just one run on three hits over five full innings.