NEW YORK -- Madison Bumgarner threw seven solid innings Thursday afternoon and Juan Perez and Ehire Adrianza each had an RBI in the fourth inning to lift the San Francisco Giants to a 2-1 win over the New York Mets on Thursday.
The Giants (70-82) won for the fifth time in six games and ensured remaining at least 1 1/2 games ahead of last-place Colorado in the National League West. San Francisco is trying to avoid becoming just the second defending World Series champion to finish last in its division. The Florida Marlins finished last in the NL East in 1998.
The Mets (68-84) lost seven of 11 on their penultimate homestand of the season.
Bumgarner improved to 13-9 after allowing one run on four hits and three walks while striking out 10. It was the 13th career double-digit strikeout game for Bumgarner, who is one strikeout shy of 200 for the season.
Jean Machi threw a perfect eighth inning for the Giants. Santiago Casilla issued a leadoff walk to Matt den Dekker in the ninth before Javier Lopez earned his first save of the year by retiring the final two batters.
Perez had a career-high three hits, all singles, and a walk in four plate appearances while Tony Abreu had two hits for the Giants, who scored both their runs off Jonathon Niese in a 15-pitch span in the fourth inning.
With one out, Hector Sanchez doubled and went to third on Joaquin Arias' single. Perez's second single of the game brought home Sanchez and Arias scored when Adrianza -- who made his first big league start Thursday -- beat out a potential inning-ending double play ball.
Bumgarner didn't allow a hit until the fourth inning, when Josh Satin led off with a double and scored on Daniel Murphy's single. Bumgarner retired the next seven batters before the Mets threatened again in the sixth, when Satin walked with one out and went to third on Andrew Brown's two-out single.
Wilmer Flores then hit a line drive at Bumgarner, but the ball bounced off Bumgarner's leg and right to first baseman Buster Posey, who stepped on the bag for the final out.
With two outs in the seventh, Omar Quintanilla singled and pinch-hitter Zach Lutz drew a walk before Bumgarner got Eric Young to ground out on his final pitch of the afternoon.
Satin, who had the game-winning two-run single in the ninth inning of the Mets' 5-4 victory on Wednesday, reached base twice in four plate appearances.
Niese fell to 7-8 after allowing the two runs on seven hits and two walks while striking out four over seven innings.
NOTES: Terry Collins said 3B David Wright (strained right hamstring) would likely return to the Mets' lineup for Friday's series opener in Philadelphia. Wright suffered a Grade 3 strain on Aug. 2. ... With SS Ruben Tejada out for the year after suffering a broken right fibula on Wednesday night, the Mets are expected to recall SS Wilfredo Tovar in time for Friday's game. Collins said Tovar will platoon at shortstop with Omar Quintanilla over the final nine days of the season. ... The Giants visit the New York Yankees in a three-game series Friday through Sunday, which makes this week the first time the Giants have played six straight games in New York since the franchise's final season in New York in 1957. ... With his next strikeout, Bumgarner will become the fifth left-hander in Giants history to whiff 200 in a season.