SAN FRANCISCO -- Pablo Sandoval homered and drove in three runs, rookie Chris Stratton pitched six strong innings and the San Francisco Giants beat the Arizona Diamondbacks 7-2 on Sunday.
The Diamondbacks had won 20 of 25 games and nine straight on the road. Their magic number for clinching a playoff berth was six going into Sunday.
The Giants snapped a four-game skid. Stratton (3-3) struck out four and gave up two runs, five hits and a walk.
Stratton also had the first of three singles leading off San Francisco's three-run fifth. He scored when Austin Slater drew a four-pitch walk off starter Taijuan Walker (9-8).
The Giants loaded the bases with no outs three times -- off Walker in the fourth and fifth innings and against T.J. McFarland in the seventh.
Sandoval homered leading off the sixth -- his third in 37 games since returning to the Giants in July. He's batting .185 since being acquired.
Sandoval drove in a run in the seventh with a fielder's choice on a fly ball that dropped near left fielder David Peralta, who fired to second get a force out on Brandon Crawford. Sandoval also knocked in the game's first run with a sacrifice fly in the fifth.
J.D. Martinez hit a two-run homer off Stratton in the sixth, his 24th home run in 51 games since the Diamondbacks acquired him in a July trade with the Detroit Tigers.
Walker gave up four runs and seven hits in five innings.
STARTERS' STREAK SNAPPED
Walker's outing snapped a streak of eight straight games in which Diamondbacks starters gave up two or fewer runs. Starters were a combined 5-0 with a 1.62 ERA over that stretch.
Diamondbacks LHP Patrick Corbin (14-12, 4.06 ERA) will pitch Monday's series opener in San Diego. Corbin is 6-1 with a 2.12 ERA in his last seven starts. He's 5-6 with a 4.29 ERA in 15 career outings (including 10 starts) against the Padres.