Lincecum (13-9) allowed three runs on five hits with 11 strikeouts for the Giants, who have captured the first two of this three-game series but remained one game behind the NL West-leading Padres. San Diego held off the Dodgers, 2-1, Tuesday night.
Pat Burrell and Aubrey Huff both hit a two-run homer while Freddy Sanchez added a solo blast in the victory.
Chris Young homered for the Diamondbacks, who have dropped four straight.
Barry Enright (6-3) suffered the loss and was charged with six runs on nine hits in six innings of work.
The Giants jumped out to an early 3-0 lead in the first inning. Andres Torres led off the game with a double to right field and scored on Huff's two-out home run that cleared the wall in right field. It was Huff's 23rd homer.
Later in the frame, Buster Posey doubled and scored on a Jose Guillen single.
"It was tough for the team (that I allowed) us to get into an early hole," said Enright. "I tried to battle, but they had my number tonight."
Lincecum was perfect through four innings and then received more run support when Sanchez hit a two-out, solo blast to right for a 4-0 cushion in the fifth.
"I had a pretty good roll in the first few innings and got some quick outs to get the offense back in the dugout, and when that happens, you put yourself in a better position," said Lincecum. "It was important to get early strikes."
The D'Backs finally solved Lincecum in the fifth when Miguel Montero singled with one out, but Burrell's two-run homer in the sixth pushed the visitors' lead to six. Posey led off with a base hit and scored on Burrell's 14th home run with San Francisco this season.
Arizona cut its deficit in half in the bottom of the seventh. Kelly Johnson led off with a triple and Young followed with a towering home run to left field as Lincecum began to show signs of fatigue. Montero then singled with one out and raced around to score on a two-out triple by Tony Abreu -- the second three-base hit of the stanza.
That marked the end of the night for Lincecum, who was replaced by Javier Lopez. Lopez induced an inning-ending groundout off the bat of Gerardo Parra.
In the bottom of the eighth, Lopez was perfect and Sergio Romo got the first out of the ninth. After Adam LaRoche singled to center field, the Giants summoned Jeremy Affeldt from the bullpen and he induced a game-ending 4-6-3 double play.
For his efforts, Affeldt earned his fourth save of the campaign.
The contest was completed in a swift 2 hours, 16 minutes...The Giants outhit the D'Backs, 9-6...San Francisco finished 2-for-10 with runners in scoring position...The Giants have won six straight road games against Arizona...The scheduled pitching matchup for Wednesday's series finale is set to feature Giants southpaw Barry Zito against Dan Hudson...Lincecum is now 6-2 with a 2.71 ERA in 13 career starts against Arizona...This marked Lincecum's sixth double-digit strikeout effort of the season.