Angel Pagan hit an RBI single and drew a bases-loaded walk to back Lincecum (3-8) as the Giants moved into a first-place tie in the NL West with the Dodgers by completing their second sweep of the season.
It was the first time in franchise history that they shut out the rival Dodgers in a three-game series, a stretch that spans 123 seasons.
Lincecum threw four-hit ball over seven innings for his first win since April 28. He struck out eight and walked two while outpitching Chad Billingsley (4-7). The two-time Cy Young Award winner ended a career-long 10-start winless stretch in which he went a career-worst 0-6.
He was 0-4 in his previous six starts against Los Angeles since his last victory on July 30, 2010.
Already missing injured All-Star Matt Kemp, the Dodgers lost Andre Ethier after one at-bat to a left oblique injury that could land him on the disabled list.
PIRATES 11, PHILLIES 7
PHILADELPHIA (AP) — Chase Utley homered in his first at-bat of the season, but Pittsburgh spoiled his return by connecting three times to beat Philadelphia.
Michael McKenry hit a three-run homer and Andrew McCutchen and Casey McGehee also went deep for the Pirates in their highest-scoring game of the season.
Utley missed the first 76 games this year because of a chronic problem in both knees. He had three hits, but it wasn't enough on a night the Phillies got more encouraging news about their injured stars.
Former NL MVP Ryan Howard will start a rehab stint Thursday night and two-time Cy Young Award winner Roy Halladay is making progress and could throw off a bullpen mound next week.
James McDonald (7-3) allowed four runs in 5 2-3 innings. It was the first time in 15 starts this season he gave up more than three runs.
Reliever Raul Valdes (2-1) started for the Phillies, who were out of starters because of a doubleheader Sunday.
NATIONALS 11, ROCKIES 5
DENVER (AP) — Jordan Zimmermann pitched seven strong innings, Ryan Zimmerman and Tyler Moore both homered for the second straight game and Washington beat Colorado.
Moore finished with three hits, Ian Desmond also went deep and Bryce Harper had two hits for the Nationals, who had another big outburst at the plate. Washington scored nine runs once in its first 71 games before accomplishing the feat on consecutive nights against the Rockies.
Marco Scutaro had two hits and two RBIs for Colorado, which matched the Nationals with 14 hits but lost for the 16th time in 20 games.
The Nationals battered Rockies pitching again, one day after setting club marks for hits and extra-base hits since moving to Washington. They roughed up starter Edwar Cabrera (0-1), who was making his major league debut after getting called up from Double-A.
Zimmermann (4-6) picked up his first win since May 22.
BREWERS 8, REDS 4
CINCINNATI (AP) — Rickie Weeks and Cody Ransom each hit a two-run homer off Homer Bailey, and Milwaukee avoided a three-game sweep by beating Cincinnati.
Zack Greinke (9-2) remained unbeaten against the Reds, allowing two runs in six innings. Greinke is 4-0 in six career starts against Cincinnati.
Bailey (5-6) has had nothing but trouble against Milwaukee, falling to 0-5 in 10 games with a 6.50 ERA. He left trailing 5-2 after failing to get an out in the fifth inning.
The defending NL Central champions left town 7 1/2 games behind the first-place Reds. Ryan Braun was out of the Brewers' lineup with a tender left elbow.
METS 17, CUBS 1
CHICAGO (AP) — Daniel Murphy homered twice, Scott Hairston hit a grand slam and David Wright drove in five runs as New York routed Chicago.
Ike Davis had a three-run homer and an RBI double as he combined with Murphy, Hairston and Wright to drive in all 17 runs — with each having at least four RBIs — to help the Mets snap a four-game losing streak.
The Mets had their highest-scoring game since they put up 18 runs at Wrigley Field on Sept. 5, 2010. It was also the most runs the Cubs have allowed since that game.
Murphy hadn't homered since last July 16 but went deep in consecutive innings for his first multihomer game. Davis' four RBIs matched his career high and Hairston had his second career slam.
The onslaught made for an easy afternoon for Jonathon Niese (6-3), who went seven innings and improved to 4-0 with a 1.89 ERA in day games.
The Mets' first seven hits went for extra bases, six of them off starter Jeff Samardzija (5-7). Samardzija also walked four and gave up a career-high nine runs in 4 1-3 innings. He dropped to 0-4 with an 11.29 over his last four starts.
BRAVES 6, DIAMONDBACKS 4
ATLANTA (AP) — Chipper Jones and Jason Heyward homered, and Atlanta withstood Arizona's comeback attempt.
Jones' two-run shot off Trevor Cahill (6-6) in the sixth inning was his first homer since May 4.
Tommy Hanson (9-4) gave up three runs and seven hits in 6 1-3 innings. Craig Kimbrel struck out the side in the ninth to earn his NL-leading 22nd save.
The Braves led 6-0 before Ryan Roberts' three-run homer in the seventh knocked Hanson out of the game. Chris Young added a pinch-hit homer off Jonny Venters later in the inning.
Diamondbacks shortstop Stephen Drew was 1 for 4 as he came off the disabled list to make his first start since July 20, 2011. He had been sidelined while recovering from a broken right ankle that required surgery.
MARLINS 5, CARDINALS 3
MIAMI (AP) — John Buck and pinch-hitter Logan Morrison connected for consecutive home runs in the seventh inning, rallying Miami past St. Louis to end its eight-game losing streak against the Cardinals.
St. Louis had won five in a row overall. Miami won for just the fourth time in 21 games.
Tony Cruz's first career homer in the seventh put the Cardinals ahead 3-2.
Buck tied it when he homered off Fernando Salas. Morrison then sent a drive off Sam Freeman (0-1) that hit the top of the right-field fence, bounced off a nearby railing and dropped back into play.
After stopping at second base while umpires reviewed the play, Morrison was allowed to finish his home run trot. It was his first career pinch-hit home run.
Anibal Sanchez (4-6) ended his three-game losing streak, allowing three runs in seven innings. Heath Bell earned his 15th save in 19 chances.
ASTROS 1, PADRES 0
HOUSTON (AP) — Lucas Harrell pitched his first complete game and left fielder J.D. Martinez threw out a runner at the plate in the ninth inning to preserve Houston's victory over San Diego.
Matt Downs homered and Harrell (7-6) finished a six-hitter by striking out Nick Hundley with the bases loaded.
The drive by Downs was one of only two hits by the Astros, who couldn't get anything else going against starter Clayton Richard (5-8).