Neil Walker hit a two-run homer in the first inning, one of six Pittsburgh hits off Halladay (8-3), who had six strikeouts and one walk in tying for the most wins in the majors.
Ryan Howard had three RBIs, Chase Utley was on base four times and Placido Polanco had two hits and scored twice for Philadelphia.
Playing without leadoff hitter Jimmy Rollins (bruised knee), the struggling Phillies offense - seven runs in the previous four games - broke out with 14 hits and was aided by seven walks, two hit batters, two wild pitches and a passed ball.
The Phillies had only one hit during the fourth and fifth innings when they scored their first three runs. But they banged out 11 hits over the final four innings.
Halladay avoided the distinction of allowing 10 or more hits for three consecutive starts for the first time in his career. With two outs in the sixth of what was then a two-run game, Brandon Wood and pinch-hitter Matt Diaz singled off Halladay. Pinch-hitter Jose Tabata then sharply lined the first pitch he saw toward right, but second baseman Utley extended for a spectacular diving catch to end the inning.
Raul Ibanez earned his 1,000th career RBI on a sacrifice fly in the fourth, and the Phillies scored twice in the fifth after James McDonald was pulled upon throwing 12 consecutive balls to load the bases with nobody out.
McDonald (3-4) came in having allowed only four runs in his previous three starts but had control issues, walking five, hitting a batter and throwing two wild pitches in four-plus innings.
Walker sent a high cutter from Halladay to right-center for his eighth homer of the season, giving him a team-high 39 RBIs - most among National League second basemen.
Pittsburgh added a run in the eighth off Jose Contreras to pull within 5-3, but Antonio Bastardo struck out Garrett Jones with two on to end the inning.
Polanco and Shane Victorino had RBI singles for the Phillies, who completed a 4-5 road trip.
NOTES: The Pirates' average attendance entering the series was 18,765, but an average of nearly twice that (108,807 total) showed up for the three games against the Phillies - the fourth-largest three-game series in PNC Park history. The crowds were aided by several thousand Philadelphia fans. ... Pittsburgh (28-30) missed a chance to move to .500 this late in the season for the first time in six years. ... The Phillies had a sure run taken away in the fourth when a ball hit by Domonic Brown struck umpire Chad Fairchild and, by rule, Howard was not permitted to advance from third.