Jeff Keppinger's two-run double in the 1, in the second meeting of a four-game set.
Bumgarner (8-12) pitched 6 1/3 innings, allowing one run on five hits and three walks. Ramon Ramirez stranded a pair in the seventh and pitched a perfect eighth before Santiago Casilla finished off the win in the ninth for his second save.
The win was San Francisco's third in five games, though the club still trails the NL West-leading Diamondbacks by three games.
J.A. Happ (4-15) was the hard-luck loser, surrendering two runs -- one earned -- on four hits and four walks over six frames.