Pablo Sandoval hit a tie-breaking two-run homer with two out in the 11th inning to lead the Giants to a 6-4 victory Sunday.
The score had been tied 4-4 since the fourth inning and the Giants missed a few opportunities to take the lead until Sandoval's 15th homer off Mark Melancon (6-4).
It's been tough for the Giants lately. They've lost 17 of their last 23 games. The Astros made two outstanding defensive plays to keep the score tied.
"It's frustrating, especially when you've been in a streak like we've been in and lost two straight here," Giants manager Bruce Bochy said. "You're hoping that somebody comes through but they made two unbelievable defensive plays that saved them. It was a great job on their part."
|More on Giants at Astros|
Sandoval, playing with nagging injuries, was pleased to get it over.
"I'm tired," Sandoval said. "I just was looking for a pitch to hit. Now we go home, got a day off and come Tuesday, play hard. I've been hurting so I'll enjoy that day. I just want to play and help team win a game."
Jeremy Affeldt (2-2) pitched two innings for the victory. He has allowed one earned in 17 1/3 innings since the All-Star break.
The Giants left 12 base runners stranded, including seven over the final five innings. The loss snapped a four-game winning streak for the Astros, equaling their longest of the season.
Brandon Belt hit a three-run homer in the second inning and had a career high four hits.
The Astros kept coming up with big defensive plays to keep the score tied.
"I thought our guys did a great job of battling all the way until the end," Astros manager Brad Mills said. "It seemed like the leadoff guy got on in every inning. Our guys had to really buckle down and work out of jams, and they did. There were a lot of quality pitches being made."
The Giants were poised to take the lead in the eighth with the bases loaded and one out. Instead, Chris Stewart hit a fly to left fielder J.D. Martinez, who caught it for the second out and then made a perfect throw to catcher Carlos Corporan, who blocked the plate and tagged Nate Schierholtz sliding into home plate.
San Francisco loaded the bases with two outs in the ninth but Schierholtz flew out to center field to keep the score tied. The Giants left seven runners stranded in the seventh, eighth and ninth.
Aaron Rowand led off the ninth with a single. He took off for second when a pickoff throw got past first baseman Carlos Lee. The ball bounced perfectly off the fence back to second baseman Jose Altuve, who threw out Rowand at second.
"When you're in one of these streaks, what can go wrong does go wrong," Bochy said. "They got a break there and throw the guy out at second. There's nobody out and a man on first, yeah, it's a tough break."
Giants starter Dan Runzler made his major league debut as a starter after 71 appearances in relief. He didn't get out of the second inning. He allowed four runs, walked three and struck out two.
Henry Sosa pitched five innings against his former team but didn't figure in the outcome.
San Francisco got a quick lead off Sosa on Belt's 3-run homer for the early lead but the Astros battered Runzler and Guillermo Mota for four runs in the second inning that included four walks.
Mike Fontenot's sacrifice fly tied it in the fourth inning.
"We survived it is the best way to put it," Bochy said. "We're not too far back. We're fortunate."
- The Giants placed closer Brian Wilson on the 15-daydisabled list retroactive to Tuesday with inflammation in his right elbow and recalled RHP Steve Edlefsen from Triple-A Fresno.
- The Astros optioned RHP Jordan Lyles to Triple-A Oklahoma City Sunday in anticipation of OF Jordan Schafer coming off the disabled list on Monday. General manager Ed Wade said Lyles would return with the September call ups.