HOUSTON (AP) -- The San Francisco Giants couldn't get much going offensively on Tuesday night, so manager Bruce Bochy went to his bench with the game on the line in the ninth inning.
Pinch-hitters Joaquin Arias and Hector Sanchez came through for the Giants, both driving in runs to help San Francisco rally for a 3-2 win over the Houston Astros.
The Giants were down 2-1 entering the ninth. Brandon Belt singled off Wesley Wright to start inning before Arias doubled down the left-field line off Wilton Lopez (5-3) to score Belt and tie it at 2.
Sanchez completed the rally with his one-out liner to center field that scored Arias, and the Giants extended their NL West lead to a season-high 3 1/2 games over Los Angeles.
''The bench came through for us tonight,'' Bochy said. ''They saved us. It just goes to show you how important the bench is. They delivered tonight.''
Sanchez is 5 for 13 as a pinch-hitter this season.
''It's my job to be ready in that situation,'' he said. ''I'll take it. It's a good one.''
Houston took the lead on a wild pitch by Matt Cain in the eighth inning. The game was tied 1-all when Jimmy Paredes, in his first game since being recalled from Triple-A Oklahoma City, drew a walk. Brett Wallace singled before a sacrifice bunt by Jason Castro left runners at second and third.
Then came the wild pitch in the dirt that bounced between the legs of catcher Buster Posey and off the backstop. Posey went to get the ball and Paredes trotted home ahead of the throw and over a diving Cain to put Houston up 2-1.
''I just threw it too short for Buster,'' Cain said. ''I just didn't execute the pitch.''
Santiago Casilla (5-5) retired the last two batters in the eighth for the win and Sergio Romo threw a perfect ninth for his seventh save.
Angel Pagan put San Francisco up 1-0 when he homered to right field with two outs in the fifth. Houston evened it up when Fernando Martinez opened the bottom half with a homer to right-center.
The loss dropped Astros interim manager Tony DeFrancesco to 1-7 and came in front of 13,516 fans - the smallest crowd in the history of Houston's 12-year-old ballpark. DeFrancesco took over on Aug. 19 after Brad Mills became the first manager in the majors to be fired this season.
The Astros have lost four of their eight games under DeFrancesco by two runs or less.
''Eventually, it is going to turn,'' he said. ''We have a lot of confidence in the guys in there. The effort is there. I am watching guys go hard every day. It's sort of frustrating to the manager and coaching staff not to get the 'W.'''
Houston starter Bud Norris was lifted in the seventh with a blister on his right middle finger. He retired the first two batters in the inning before falling behind 2-0 to Pagan.
Trainers checked out Norris and chatted with him before he was replaced by Fernando Rodriguez.
''It is kind of aggravating him a little bit, so he is having a tough time commanding his slider,'' DeFrancesco said. ''Going into the sixth inning and the seventh, it is more painful. ... He can handle it, but when the pain starts beating on him and throbbing, then it's time to come out of the game.''
Norris is mired in a career-worst 10-game losing streak and hasn't won since May 21. He allowed six hits and a run with seven strikeouts.
Cain, who pitched a perfect game against Houston on June 13, allowed six hits and two runs with three walks in 7 1-3 innings.
''I felt good,'' he said. ''I felt like I was able to throw a lot of pitches for strikes anytime I kind of wanted to.''
Cain didn't allow a hit until Wallace doubled with one out in the fourth. Pagan fielded the ball near the wall in center field and threw to cutoff man Brandon Crawford, who caught the throw right before Gregor Blanco came dashing in from left field and crashed into him.
The collision sent both players tumbling to the ground, but neither was injured.
Cain was helped by his defense in the first when Castro hit a pop fly into foul territory. Third baseman Pablo Sandoval attempted to make the catch, but the ball bounced out of his glove and into the air. Crawford then made a diving grab before the ball hit the ground.
''It was big,'' Cain said. ''Those guys have done a great job for me all year, picking me up at times and making some spectacular plays behind me. As a pitcher that just motivates you to keep wanting to go out there and pitch well.''
NOTES: Giants reliever Guillermo Mota was activated from the restricted list after serving a 100-game suspension for his second positive drug test. LHP Jeremy Affeldt was placed on the paternity leave list. Affeldt and his wife, Larissa, had their third child Tuesday, a boy named Kolt Kristopher. ... The teams continue the series Wednesday when San Francisco left-hander Barry Zito opposes Dallas Keuchel.