Tim Lincecum struck out 11, three San Francisco players homered and the Giants beat the Arizona Diamondbacks 6-3 on Tuesday night to keep up the pressure on San Diego in the NL West.

The Giants have won four straight and six of seven. They remained a game behind the first-place Padres, who beat the Los Angeles Dodgers 2-1, and moved within one game of Atlanta, which leads the wild-card standings.

Lincecum (13-9) allowed one runner, on Miguel Montero's single, through six innings before the Diamondbacks broke through in the seventh. He left after 6 2-3 innings, giving up three runs and five hits with no walks.

Aubrey Huff, Freddy Sanchez and Pat Burrell homered off Barry Enright (6-3).

Jeremy Affeldt induced a game-ending double play for a one-pitch save. It was his fourth of the season.

Chris Young homered for the Diamondbacks in a game that took just 2 hours, 16 minutes — Arizona's shortest of the year.

Lincecum earned his second victory in a row after an awful August, when the two-time reigning NL Cy Young Award winner went 0-5 with a 7.82 ERA.

He retired his first 12 batters and 17 of 18 and had a 6-0 lead before faltering in the seventh. Kelly Johnson led off the inning with a triple and Young followed with his 24th home run.

Lincecum fanned Adam LaRoche, then Montero singled. Brandon Allen struck out for the third time, but Tony Abreu's RBI triple to left-center cut the lead to 6-3 and ended Lincecum's night.

Enright had not allowed more than three runs in any of his first 12 major league starts since he was called up from Double-A Mobile. The Giants, though, scored that many in the first inning off the 24-year-old right-hander, two on Huff's 23rd home run.

After three scoreless innings, the Giants got a solo homer from Sanchez in the fifth and a two-run shot from Burrell in the sixth.

Andres Torres opened the game with a double. With one out, Huff hit Enright's first pitch deep into the seats in right field. Buster Posey followed with a shot some 415 feet high off the wall in center for a double. He scored on Jose Guillen's two-out single off the bullpen fence in left.

Enright entered with the second-best ERA in the majors (2.45) among rookies with a minimum of 12 starts, trailing only Jaime Garcia's 2.35 for St. Louis. The three homers were the most he had allowed in a game.

Notes: Lincecum is 43-3 when the Giants score at least three runs for him. ... The Chase Field roof was open for the first time since June 11. ... The Diamondbacks were without 3B Mark Reynolds because of a bruised right hand. ... The Diamondbacks said an MRI on OF Justin Upton's sore left shoulder showed no significant damage. ... San Francisco 3B Pablo Sandoval got the night off. ... Arizona recalled OF Cole Gillespie from Triple-A Reno, his third stint with the team this season.