SAN FRANCISCO (AP) — Jon Niese once again had nothing to show for another strong start for the New York Mets.
Buster Posey hit a tiebreaking two-run homer off reliever Carlos Torres in the eighth inning and the San Francisco Giants won for the eighth time in 10 games by beating New York 4-2 on Friday night.
Niese matched Matt Cain for seven innings, allowing two runs and five hits to extend his streak of consecutive starts allowing three earned runs or fewer to 16. But a lack of run support left him with another no-decision.
"It's tough," he said. "You go out there and battle and you want to see the win beside your name. But it is what it is, it's part of the game. It'll come eventually. I have all the confidence in the offense we have here. They're going to put up runs."
The Mets couldn't do it against Cain and San Francisco's bullpen as they lost their fourth straight game. The relievers have taken all of those losses with the winning rally by the Giants starting when Torres (2-3) walked Angel Pagan to open the eighth.
One out later, Posey hit a long drive to left-center to snap a 93 at-bat homer drought as the Giants (40-21) became the first team in the majors to reach 40 wins.
"The walks are killing us," Mets manager Terry Collins said. "It's certainly something that you know when you grow up in the game, you walk people, it'll come back to burn you. Right now, we walk people and they seem like they score."
The homer capped a three-hit day for Posey, who entered the game with only four hits in his past 42 at-bats at home and no homers since May 3.
"He's a talented hitter," Giants manager Bruce Bochy said. "We all have our ups and downs. We talk about that all the time. He saw the ball well tonight."
Jeremy Affeldt (1-1) pitched a scoreless eighth on his 35th birthday to get the win. Sergio Romo got three outs for his 19th save in 21 chances.
Cain allowed two runs and three hits in seven innings in his first start back from a stint on the disabled list for a strained right hamstring. But he got a no-decision and still has only one win in nine starts in a rough season that has included two trips to the disabled list.
Cain was in complete control with a 1-0 lead having faced the minimum 18 batters through six innings before the Mets quickly turned the tide in the seventh.
Matt den Dekker led off the inning with a double for New York's second hit of the game and Daniel Murphy followed with his fourth home run of the season to put the Mets ahead 2-1.
The Giants tied it in the bottom half when Brandon Hicks and Brandon Crawford teamed up again to produce a run. Hicks drew a two-out walk from Jonathon Niese, advanced to second on a wild pitch and scored on Crawford's single to center.
The duo produced San Francisco's first run in the fifth when Hicks tripled and scored on Crawford's sacrifice fly to make it 1-0.
"It is frustrating for Jon because he threw the ball so well," Murphy said. "I think he'll be upset that he feels like he may have made a couple of mistakes and they punished him for it. He threw the ball well enough to win."
Cain retired the first 12 batters of the game before walking Curtis Granderson to lead off the fifth. Granderson was quickly erased when Andrew Brown hit into a double play.
The Mets got the leadoff runner on again in the sixth when Ruben Tejada reached on an infield single. Cain once again followed that by inducing a double-play grounder by Travis d'Arnaud.
NOTES: There was a pregame moment of silence for Don Zimmer, who coached for San Francisco and played for the Mets. Zimmer died Wednesday at age 83. ... Bartolo Colon (5-5) starts Saturday for the Mets against Tim Hudson (6-2).