After losing five games in a six-game road trip to conclude the first half, the Giants jumped to an early lead when Posey drilled a 2-0 pitch to center for a 448-foot shot that also plated Ryan Theriot.
"I thought it was important for us to get back on track and play good ball," manager Bruce Bochy said. "You've got to bounce back in this game, and that's what this club did today after a tough road trip."
The Giants tacked on two more runs in the second by capitalizing on timely hitting and their speed. The Giants opened with back-to-back singles from Pagan and Brandon Belt, and a well executed hit-and-run allowed Pagan to score from second on Arias' slow chopper that got past the reach of Astros shortstop Jed Lowrie. Belt went all the way to third base from first on the play, and later came around to score on Justin Christian's groundout to third.
And the combination of power and small ball was more than enough for Bumgarner, who held the Astros to two hits in seven innings pitched. Lowrie's single in the second was the only hit Bumgarner gave up until Chris Snyder's two-out homer in the seventh.
Using a new-look curveball that he developed with the help of fellow lefty teammate Jeremy Affeldt, Bumgarner continued his stellar pitching at AT&T Park this season. The 22-year-old now has gone 7-1 with a 1.80 ERA at home this season.
"He loves pitching here," Bochy said. "He's thrown so well here. It's a case where I think he's feeding off the fans a little bit, too. That gets him going and keeps him pumped up."
In addition to his comfort at home, Bumgarner credited the four runs with allowing him to take the pressure off and settle down.
"It's nice to get out to an early lead, it takes a little pressure off," Bumgarner said. "You're still trying to go out there and pitch your game and make pitches, but if you mess up here and there, it's still going to be OK."
The Giants got an insurance run in the eighth in a big way when Pablo Sandoval scored from third base on Pagan's sacrifice fly, blasting into Snyder and forcing the catcher to mishandle the throw to the plate.
"That's a lot of mass coming in a home plate," Bochy said.
The play made for quite the collision, though Snyder and the 240-pound former catcher Sandoval both came out of it all right.
"I had no problem with that," Snyder said. "I came out fine. I just didn't hold on to the ball."
Sandoval had reached with a triple to left field, which came after his bases-loaded triple in Tuesday's All-Star Game, which was his first of the year. He wore the same orange cleats from the All-Star Game, which violated the Major League Baseball rules that said he could wear only shoes that were half orange to match his uniform, a lesson Sandoval learned when he did the same thing after last year's All-Star Game.
"Maybe it's the shoes," Sandoval said. "They've given me good luck."