The Pirates had just three hits after the first inning but already had enough runs to beat Kyle Kendrick (2-8), who allowed five hits and walked three while striking out six over seven innings.
Pittsburgh starter A.J. Burnett (9-2) tied a 38-year-old Pirates record by winning his eighth consecutive start. The last Pittsburgh pitcher with that kind of winning streak was Dock Ellis in 1974.
Burnett allowed three runs on six hits and two walks. He struck out seven in his 6 2/3-inning stint.
Drew Sutton opened the game with a single and Neil Walker walked. After an out, Garrett Jones singled in Sutton. McGehee then connected for a drive deep into the seats beyond left field for his fifth home run of the season.
Pedro Alvarez followed with a line drive down the right-field line for his 14th home run of the year.
Erik Kratz hit a two-home run for Philadelphia in the second and the Phillies added singles runs in the sixth on a groundout and the eighth on Hunter Pence's 14th homer of the year to get within one.
Wisconsin business offering 'therapeutic cuddling' forced to close
Megyn Kelly: Santa Claus and Jesus are both white men