Nick Castellanos homered as Philadelphia moved a season-best 17 games over .500. Bryce Harper singled and was intentionally walked twice in his second game back after missing 52 contests with a broken left thumb.
The Phillies (72-55) are second in the NL wild-card standings with the franchise's best record since 2011 when it won the last of its five straight NL East titles.
''This group is gelling at the right time,'' said J.T. Realmuto, who had a three-run double in the first inning.
Gibson (9-5) struck out nine and walked one. Sam Coonrod worked the eighth and Nick Nelson finished the six-hitter with a 1-2-3 ninth, striking out two.
''He's really resilient, dependable and durable,'' Phillies interim manager Rob Thomson said of Gibson. ''You never have to worry about a guy like (Gibson).''
Bligh Madris doubled and Greg Allen had two hits for the Pirates, who have lost seven in a row and 13 of 15.
A night after driving in two runs with a bases-loaded, first-inning single in Philadelphia's 7-4 victory, Harper singled again in the first off Tyler Beede (1-4) to load the bases with one out. Realmuto followed with a bases-clearing double.
The Phillies added two runs in the second on Rhys Hoskins' RBI single and Alec Bohm's run-scoring groundout. Castellanos made it 6-0 when he led off the third with his 13th homer on a night with a fans' giveaway of a T-shirt with his likeness.
''They jumped on us early,'' Pirates manager Derek Shelton said. ''Our approach has to be better.''
Shelton didn't give Harper, the reigning NL MVP, a chance to do much damage. Shelton intentionally walked Harper with two outs and nobody on in the second and in the sixth with two outs and a man on first. Realmuto followed by striking out swinging after both walks.
''Just right-handed pitcher and one of the best players in baseball hitting,'' Shelton said of the strategy.
The crowd of 37,105 for Harper's return was the eighth-best of the season at Citizens Bank Park. As in Friday's contest, they cheered loudly when he came to the plate - and booed just as boisterously on the two free passes.
Philadelphia has won all six of its games against Pittsburgh this season. Only Oakland and Washington entered with fewer wins than the Pirates, who dropped to 47-79.
Beede, making his fifth consecutive start after relieving for most of the season, gave up five hits in three innings with five strikeouts and three walks. Chase De Jong followed with three scoreless innings in relief, but the Pirates came up empty at the plate.
The 34-year-old Gibson ended with seven scoreless innings for the third time this season. He has a 2.41 ERA in his last six starts.
''I was able to execute pitches when I needed to,'' he said.
Philadelphia improved to 50-26 since June 3 when Thomson replaced Joe Girardi, who was fired.
''We knew we had a good team,'' Gibson said. ''A little bit of the air got let out when Girardi was fired. (Thomson) came in and just kind of reaffirmed his confidence in our club. I think it was something we needed to hear.''
After losing his appeal, Pirates infielder Rodolfo Castro served a one-game suspension imposed by MLB for accidentally having his cell phone in his pocket on Aug. 9 against Arizona. Castro's phone fell out of his back pocket while sliding into third base.
Phillies: CF Brandon Marsh returned to the lineup after missing 10 games due to a sprained ankle. Marsh went 0 for 4 with three strikeouts.
Pirates RHP Roansy Contreras (3-4, 3.86 ERA) opposes Phillies RHP Noah Syndergaard (8-8, 3.77 ERA) in the finale of the three-game series on Sunday.
More AP MLB: https://apnews.com/hub/mlb and https://twitter.com/AP-Sports
Copyright 2023 STATS LLC and Associated Press. Any commercial use or distribution without the express written consent of STATS LLC and Associated Press is strictly prohibited.