BOSTON — The Boston Red Sox just keep pulling out those games that can make a team think seriously about October.

On Saturday, for the third time in a week, the Red Sox came from behind, this time wiping out a 5-2 deficit and pulling out a 6-5 win over the New York Yankees.

“I wouldn’t just limit it to these last three. I think the last maybe three weeks,” manager John Farrell said after Boston’s third straight win — moving the Red Sox 20 games above .500 for the first time this season. “I think we jelled even further having to go out to the West Coast a couple of times. Lengthy road trips.

“There was an inner belief among our group that continued to grow and then you put on top of that these three come from behind wins in this past week … those are key games and not always in the most friendliest situations.”

The teams played the series finale Sunday night.

Last Sunday in Toronto, the Red Sox came back from a 6-4 deficit and won 11-8. Then, after losing two of three to the Baltimore Orioles to start a seven-game homestand, they rallied with one in the eighth and five in the ninth to beat the Yankees on Thursday. After a 7-4 win Friday, they scored two in the fifth and two in the seventh — the winning run scoring on a wild pitch.

“It’s incredible. It’s fun,” said reliever Matt Barnes, who got the win. “It’s really fun to be a part of.

“This is a team that we’ve gone through struggles, not too many, but we know the capability of this team. This team never gives up. You kind of know from start to finish it never stops.”

On Saturday, they overcame a shaky start by David Price, who struggled through six innings in failing to win his eighth straight start. But he kept things close enough and Xander Bogaerts, who also had two doubles, hit a two-run homer off Yankees starter Bryan Mitchell in the sixth.

“It was a very big win,” Price said. “These guys had my back. We find a way to win.”

Mookie Betts scored the go-ahead run on a wild pitch by Adam Warren (3-2) with two outs in the seventh.

The Yankee lost Starlin Castro (hamstring) and Jacoby Ellsbury (knee) to injuries — both were returning to New York for MRIs.

“It’s been tough and just frustrating because I felt like we were on a good roll there and just kind of haven’t been able to finish a game and come out on top the last couple,” Yankees manager Joe Girardi said.

“We know we’re making it tough on ourselves and don’t expect this group to give up until we’re eliminated.”

Price gave up five runs and nine hits — two of the runs coming on a long home run by rookie Gary Sanchez, his 15th homer in 152 big-league at-bats.

Bogaerts hit his 20th homer of the season, giving the Red Sox five 20-homer hitters, to make it 5-4.

He then doubled to start the seventh. Left-hander Tommy Layne replaced Luis Severino (first run allowed in nine relief appearances) and David Ortiz moved Bogaerts to third with a long flyout. On came Warren and Betts tied the score by chopping one over a drawn-in infield.

Hanley Ramirez then picked up his third hit and the runners moved up on a groundout before Warren uncorked his wild pitch. Ramirez, coming around third, made a dash for the plate with catcher Austin Romine out of the area. Romine recovered and tagged Ramirez just in time.

Barnes (4-3) worked 1 1/3 innings and Craig Kimbrel came on with two outs in the eighth and struck out four straight batters for his second four-out save of the season — his 27th overall.

Romine had a towering two-run triple in the fourth inning in the loss.

NOTES: Boston RHP Steven Wright, still out with a right shoulder injury suffered diving into second as a pinch runner, will go to Fort Myers, Fla., on Monday to start a throwing program. He is not expected to pitch again, at least in the regular season. … LHP Drew Pomeranz says he was unaware of the medical information withheld by the Padres leading to general manager C.J. Prella getting a 30-day suspension.