After grabbing an early 2-0 lead, the Giants exploded for six runs in the fourth, banging out six hits to put the contest away.
Posey later added an run-scoring single while Brandon Crawford went 4-for-5 with an RBI.
Brandon Belt contributed three hits and Hunter Pence socked solo homer as Giants evened their three-game series.
Bumgarner (5-4) notched his first win in nearly a month, yielding three runs on five hits over five innings. He walked one and struck out four.
Arizona starter Trevor Cahill (3-7) was lit up for eight runs on nine hits over just 3 2/3 innings.
Willie Bloomquist, A.J. Pollock, Paul Goldschmidt and Miguel Montero each knocked in a run for the National League West-leading Diamondbacks, whose lead over the third-place Giants shrank to 2 1/2 games.
NBC reportedly holds celebs hostage to Jimmy Fallon's show
Boston schools pull out free condoms over wrapping complaints