SAN FRANCISCO -- For the third time in his career, Madison Bumgarner took a no-hitter into the eighth inning. For the third time, it slipped away.
No worries, though.
The San Francisco Giants are headed to the All-Star break with the best record in the majors and a comfortable lead in the NL West, so Bumgarner didn't seem bothered that he lost yet another bid at the milestone achievement.
Bumgarner allowed Arizona's only hit to Jake Lamb with one out in the eighth inning and matched a career high with 14 strikeouts to lead the Giants over the Diamondbacks 4-0 on Sunday night.
"I don't think a one-hit shutout ever stings," Bumgarner said. "It felt good. It felt good all the way around."
Bumgarner (10-4) retired 25 of the 28 batters he faced, including two double plays, and walked one while going the distance for the third time this season.
Lamb broke up Bumgarner's bid with a lined single to right field. Lamb also reached on an error in the fifth when right fielder Gregor Blanco dropped a flyball.
Beyond that, San Francisco's four-time All-Star was nearly untouchable while notching his fourth career one-hitter.
"He was on with all of his pitches and wasn't putting a lot of effort into it," Giants manager Bruce Bochy said. "He was on top of his game. I know he's thrown one-hitters before but this was as impressive as any of them."
The Giants lefty fanned Arizona's first five hitters twice apiece, and the Diamondbacks didn't hit a ball out of the infield until Lamb's fly ball in the fifth.
After Lamb's single in the eighth, Bumgarner got Brandon Drury to ground into an inning-ending double play.
Rickie Weeks Jr. drew a leadoff walk in the ninth, but Bumgarner retired Nick Ahmed on an infield pop-up then got Jean Segura to ground into a game-ending double play.
"When you get through seven and you've got six more outs to get you feel like you have a pretty good chance," Bumgarner said. "It hasn't worked out for me. That's all right. I'll take the complete-game shutout anytime."
San Francisco was attempting to become the first team with no-hitters in five consecutive seasons. Matt Cain threw a perfect game in 2012, Tim Lincecum no-hit the Padres in 2013 and 2014 and then-rookie Chris Heston had one in 2015.
Bumgarner, who entered the game with the second-lowest ERA in the majors among qualifying pitchers, nearly got his in front of a sold-out crowd at AT&T Park while helping the Giants complete the series sweep in the final game in the majors before the All-Star break. He dropped his ERA to 1.94 this season.
"The only pitch he was leaving over the plate was his curveball, but it was breaking so much the guys had a hard time pulling the trigger on it," Arizona manager Chip Hale said. "He did what he wanted to do. The velocity wasn't high but location was outstanding."
The Giants (57-33) have the best record in baseball at the break for just the second time in the San Francisco era. They also did it in 1993 with a 59-30 mark.
Brandon Crawford drove in three runs with a sacrifice fly in the first and a two-run single in the seventh. Buster Posey added three hits including an RBI single in the first off Diamondbacks starter Archie Bradley (3-5).
Diamondbacks: Arizona returns home and will open a three-game series against the Los Angeles Dodgers on Friday.
Giants: With four players already headed to San Diego for the All-Star Game, the rest of the team will join them at Petco Park to begin a three-game series with the Padres on Friday.