Wilmer Flores and Thairo Estrada also went deep for San Francisco. The Giants improved to a majors-best 62-37 and maintained their slim lead over the Dodgers in the NL West heading into a series between the two division rivals this week at Oracle Park.
Alex Wood (9-3) struck out eight and pitched into the sixth to help San Francisco bounce back a day after the Giants lost 10-2 in their most-lopsided defeat this season.
''Any time we take a little step back guys are eager to get back to the park and right the ship,'' Wade said. ''It started out with Woody coming out pitching a great game. Our bullpen stepped up as well and our offense was able to put up some runs.''
Bryan Reynolds had two hits and scored for the Pirates.
Pittsburgh pulled All-Star second baseman Adam Frazier out of the game in the eighth inning as part of a double switch. The Pirates have agreed to trade Frazier, who leading the majors with 125 hits, to the San Diego Padres for three minor leaguers, a person familiar with the deal told The Associated Press.
The person spoke on condition of anonymity because the deal had not been announced. The trade is pending physicals. Pittsburgh is sending approximately $1.4 million to the Padres in the deal.
''It stinks for us,'' Pittsburgh catcher Jacob Stallings said. ''He's obviously set the tone at the top of our lineup all year. Mixed emotions but the overwhelming emotion is happy for him.''
Wade's first home run came on Pittsburgh starter JT Brubaker's fifth pitch and tied the game at 1-all.
Wade later sent a drive into the stands in right-center for his first career multi-home run game. He also doubled.
''These are the swings that we've seen all year,'' Giants manager Gabe Kapler said. ''Thinking back to spring training, we saw the on-base coming, we saw the selectiveness, we saw the aggressiveness in (the) zone. I just don't know that we saw as consistent of an A swing as we're seeing now. You're seeing him get that really good explosive, athletic swing off several times in each at-bat.''
Flores homered off Duane Underwood Jr. in the sixth. Steven Duggar followed with a double and scored from third on a throwing error by Pirates catcher Jacob Stallings. Curt Casali's RBI single made it 5-0.
Estrada homered in the eighth.
Wood allowed one run and five hits in 5 1/3 innings, pitching around traffic most of the afternoon to beat Pittsburgh for the second time this season.
The Pirates loaded the bases with one out in the sixth to chase Wood but failed to score. Reliever Jay Jackson got Kevin Newman to ground into a double play.
Jarlin Garcia, Tyler Rogers and Jake McGee retired three batters apiece to complete the five-hitter.
Brubaker (4-10) allowed two runs and three hits with six strikeouts in four innings. Brubaker is winless since May 29.
Wood improved to 8-0 when starting games following a San Francisco loss this season.
''To a certain degree I feel like a responsibility,'' Wood said. ''Part of me puts that on my shoulders. A lot of it is our team. That's our mantra this year. We're a resilient team.''
The Giants haven't been swept in a three-game series at home by Pittsburgh since 2016. . Wade has five home runs in his last 10 games. He also had a leadoff home run against the Cubs on June 6. . The Pirates have had at least one extra-base hit in a season-high 21 consecutive games. . Pittsburgh has won 16 of its last 23 games in San Francisco.
Giants: Brandon Belt (right knee inflammation) ran before the game and Kapler said the first baseman is ''getting closer'' to returning. . SS Brandon Crawford (left oblique strain) remains on target to return in early August, if not sooner. . Kapler is unsure what the next step will be for RHP Aaron Sanchez (right bicep tightness) but noted he most likely will pitch out of the bullpen after he comes off the Injured List. . OF Jaylin Davis has started a rehab assignment with Triple-A Sacramento.
Pirates: In a matchup of left-handers, Tyler Anderson (5-8, 4.35) faces Milwaukee's Brett Anderson (2-5, 4.26 ERA) and the NL Central-leading Brewers on Tuesday. Anderson has won two straight after losing five consecutive decisions.
Giants: RHP Logan Webb (4-3, 3.54) pitches the opener of a three-game series against the Dodgers on Tuesday. Webb has pitched a total of 12 innings over his previous three starts. LHP Julio Urias (12-3, 3.63) pitches for Los Angeles.
More AP MLB: https://apnews.com/hub/MLB and https://twitter.com/AP-Sports
Copyright 2021 STATS LLC and Associated Press. Any commercial use or distribution without the express written consent of STATS LLC and Associated Press is strictly prohibited.