Updated

Pablo Sandoval hit a tie-breaking two-run homer with two out in the 11th inning to lead the San Francisco Giants to a 6-4 victory over the Houston Astros Sunday.

The score had been tied at 4-4 since the fourth inning and the Giants missed several chances to take the lead until Sandoval's 15th homer off Mark Melancon (6-4).

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 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.

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 made his third major league start and it came against his former team. Sosa was traded to the Astros on July 19 in a deal that sent Jeff Keppinger to the Giants. He pitched five innings but did not figure in the decision.

San Francisco got a quick lead off Sosa on Belt's 3-run homer after Aubrey Huff doubled and Nate Schierholtz singled to start the second inning.

The Astros battered Runzler and Guillermo Mota for four runs in the second inning that included four walks.

Runzler yielded a single to Jimmy Paredes and walked Clint Barmes and Jason Michaels to start the second inning. Carlos Corporan hit into a double play, scoring Paredes.

Sosa walked and Jose Altuve had an RBI single to bring on Mota, who walked Jason Bourgeois and J.D. Martinez followed with a two-run single to right field for a 4-3 lead.

Mike Fontenot’s sacrifice fly tied it in the fourth inning. The Giants challenged the deadlock in the seventh when Wilton Lopez hit leadoff batter Chris Stewart and pinch hitter Orlando Cabrera singled in front of diving right fielder J.B. Shuck sending Stewart to third.

Cody Ross struck out and Jeff Keppinger hit a hot grounder to third baseman Jimmy Paredes, and Stewart was caught in a rundown.

Sergio Escalona came on to strike out Pablo Sandoval to end the threat.

Notes: The Giants placed closer Brian Wilson on the 15-day disabled 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.