Javier Lopez (3-2) got the win. Sanchez also drove in a run for the Giants, who split the series with Arizona.
Eric Chavez and A.J. Pollack each drove in runs for the Diamondbacks, who had won three of their last four.
Giants starter Madison Bumgarner threw six shutout innings, allowing four hits. He struck out nine and did not walk a batter. Bumgarner remains winless over his last seven starts.
PADRES 5, ROCKIES 2
SAN DIEGO (AP) — Pinch-hitter Nick Hundley delivered a three-run double in the seventh inning that lifted the Padres to a win over the Rockies.
San Diego has won five of six games. The Rockies have dropped five of six.
After reliever Roy Oswalt (0-5) walked home the tying run, Hundley hit a sharp grounder down the third-base line off Wilton Lopez to clear the bases.
Nick Vincent (4-2) pitched one inning for the win. Huston Street worked the ninth for his 29th save in 30 chances.
BREWERS 3, CUBS 1
CHICAGO (AP) — Yovani Gallardo tossed seven strong innings and Jeff Bianchi delivered a key pinch-hit single, leading the Brewers over the Cubs.
Gallardo (11-9) allowed one run and three hits. He is 3-0 with a 1.35 ERA in five starts since coming back from a hamstring injury that put him on the disabled list.
Bianchi keyed a three-run seventh with a two-run single.
Scott Baker pitched five shutout innings for the Cubs in his first start of the season following Tommy John surgery last year.
NATIONALS 6, MARLINS 4
MIAMI (AP) — Stephen Strasburg got past a shaky start and pitched six innings to earn his first victory in nearly a month as the Nationals beat the Marlins.
Strasburg (7-9) struck out seven and allowed four runs and four hits. He also hit a batter, threw a wild pitch and had two balks. It was his first win since Aug. 11 against Philadelphia.