Juan Uribe hit a two-run homer and drove in three runs and San Francisco's bullpen backed Jonathan Sanchez with 3 2-3 innings of scoreless relief as the Giants gained a game in the NL wild-card race with a 5-2 victory over the Arizona Diamondbacks on Wednesday night.

San Francisco (82-70) remained in a tie with Atlanta, four games behind wild card leader Colorado with 10 games to play. Florida is 4 1/2 games back.

Uribe's homer off Arizona starter Kevin Mulvey (0-2) in the sixth inning was his 14th of the season and gave the Giants a 3-0 lead. He also had an RBI double in the second. Both times he drove in Pablo Sandoval after he was walked.

Sanchez (7-12) gave up two runs in 5 1-3 innings and struck out nine in his first victory since Aug. 21.

The Giants had lost four of their previous six games, when only one of their starting pitchers got through five innings. The rotation was 0-4 with an 11.41 ERA since Barry Zito beat Colorado 10-2 on Sept. 15.

Brian Wilson struck out the side around a one-out single to Augie Ojeda in the ninth for his 36th save. He has converted nine straight.

San Francisco, which took two of three games to win the series, begins a seven-game homestand with the first game of a four-game series against the Chicago Cubs on Thursday.

Rookie Rusty Ryal broke up Sanchez's shutout bid with a one-out triple in the sixth after Miguel Montero led off the inning with a single.

Umpires used video replay to uphold the triple after Arizona manager A.J. Hinch came onto the field to argue for a home run.

Right-hander Bobby Howry replaced Sanchez and gave up a sacrifice fly to pinch-hitter Gerardo Parra to make it 3-2 before striking out Ojeda to end the inning.

Sandoval singled in one of the Giants' two unearned runs in the seventh for a 5-2 lead. Sandoval extended his hitting streak to eight games and is 23 for 48 against Arizona this season, 19 for 36 at Chase Field.

Arizona has lost four of its last five and 14 of 19.

Sanchez struck out at least one batter in each of his six innings and got Justin Upton three times. Upton was 6 for 15 with two home runs against Sanchez coming into the game.

Mulvey, making his third major league start, gave up only Uribe's two hits in six innings, walking four and striking out four.

NOTES: San Francisco 2B Freddy Sanchez will need surgery to repair a torn meniscus in his left knee, Giants manager Bruce Bochy said. He added that the Giants will attempt to delay the surgery while they are in the playoff race. Sanchez was injured when he landed awkwardly while fielding a return throw from the outfield in the first inning of a 5-4 victory over Arizona on Monday. Arizona 3B Mark Reynolds is 4 for 19 with 12 strikeouts in his career against Sanchez after getting a single and striking out twice Wednesday.