Josh Collmenter (10-10) gave up two runs on five hits with a walk and four strikeouts over seven innings for the Diamondbacks, who have won four straight. Geoff Blum, Aaron Hill and Collin Cowgill all drove in a run.
Going into its final series of the season at home against Los Angeles, Arizona is one game behind Milwaukee for the second best record in the National League.
"Our intentions are to try and win out," Diamondbacks manager Kirk Gibson said. "Wherever we go to play on Saturday is fine."
Tim Lincecum (13-14) finished a disappointing season with his second loss in as many starts after giving up five runs on eight hits in just five innings. Andres Torres and Carlos Beltran both hit solo homers for the Giants, who have lost four straight.
"I have a lot of things I need to do, throw more strikes less walks," Lincecum said of what he need to improve on for 2012. "I have to make better quality pitches."
In the first, Hill walked and Justin Upton was hit by a pitch before Montero punched a double to right-center for a 2-0 lead.
The Diamondbacks made it 3-0 in the fourth as Paul Goldschmidt led off with a double and came home later in the frame on a Cowgill double.
It was 5-0 after the fifth inning as Hill hit a ground-rule, RBI double and came home later in the frame on a Blum groundout.
Solo homers from Torres and Beltran in the sixth made it a 5-2 game.
J.J. Putz worked around two-out double in the ninth to pick up his 45th save of the season.
Arizona is 50-28 at home this season...The Giants finished with a mark of 40-41 on the road and close out their season with a three-game set against Colorado...Each team won nine games in the season series...Lincecum fell to 7-5 against Arizona in his career.