BOSTON — Things have turned tough quickly for the New York Yankees in their playoff chase.

One out from climbing within three games of the AL East lead on Thursday, the Yankees fell six games back and lost ground in the wild-card race with a 7-4 loss to the Boston Red Sox on Friday night.

Now, the Yankees need to go on another solid run like the one they started at the end of August to get closer — and they better do it fast.

“It’s frustrating. We’ve got to start winning games. That’s the bottom line,” New York manager Joe Girardi said. “It’s got to start tomorrow. We know we’re seeing a good pitcher, but it’s got to start tomorrow.”

The Yankees face streaking David Price on Saturday afternoon. They know they’ve rallied before, winning 14 of 20 games before their current three-game losing streak.

New York is four games behind co-leaders Baltimore and Toronto in the wild-card race.

“Things can change quickly,” Girardi said. “We saw it happen. We saw it change dramatically.”

Luis Cessa (4-2) gave up three runs and six hits, striking out one in five innings. In his second game since signing with the Yankees, Billy Butler hit a two-run homer in the ninth to make it 7-4, but Craig Kimbrel got two outs for his 26th save.

“We’ve just got to go get on another streak and start winning some games,” Yankees third baseman Chase Headley said.

Hanley Ramirez homered for the second straight game, and David Ortiz had a pair of hits for the AL East-leading Red Sox.

Boston maintained a two-game lead over the Baltimore Orioles, who beat the Tampa Bay Rays 5-4.

Clay Buchholz (7-10) allowed two runs on seven hits and two walks, striking out two in six innings. Ramirez homered for the ninth time in 16 games, including a three-run shot to cap a five-run ninth in Boston’s 7-5 victory Thursday night.

Ortiz singled in the first and was thrown out trying to stretch it into a double. He did double off the center-field wall in the sixth — the 1,187th extra-base hit of his career. That moved him out of a tie with Frank Robinson and into 11th on baseball’s all-time list; Lou Gehrig is next with 1,190.

Ortiz is also two doubles behind Ted Williams for second place in franchise history.

One night after rallying in the ninth and winning on Ramirez’s homer, the Red Sox took an early lead and held on.

Cessa allowed the first five batters to reach, but two of them were thrown out trying to stretch singles into doubles; Mookie Betts was also called for the potential inning-ending out stealing second, but the replay review showed he was safe. Boston still came away with two runs in the first, then added another on Ramirez’s solo homer in the fourth.

Gary Sanchez made it 3-2 with a two-run double in the fifth for the Yankees, but Boston got two more in the sixth. Ortiz doubled and scored, and Sandy Leon doubled in another run.

Jackie Bradley Jr. led off the seventh with a homer, and Boston loaded the bases on an intentional walk to Ortiz before Betts hit into a run-scoring double play to make it 7-2.

TRAINER’S ROOM

Yankees: 1B Mark Teixeira (neck) was back in the lineup after missing the previous two games.

Red Sox: Manager John Farrell said knuckleballer Steven Wright has made progress with his right shoulder that he injured diving back to a base pinch running in early August. “He’s not feeling anything right now,” Farrell said. The next step is for Wright to throw in Fort Myers, Florida, when the team heads out on a road trip.

QUICK HOOK

Cessa was pulled after 64 pitches. Girardi said he thought the third time through the lineup was a good opportunity to give Boston’s hitters “a different look.”

“Yeah, I was a little surprised,” Cessa said through a translator. “I was getting myself ready for the next inning. I knew it was going to be tough at-bats coming up, but at the end of the day it’s his decision and I respect that.”

UP NEXT

Yankees: RHP Bryan Mitchell (1-1, 6.14 ERA) makes his sixth career start Saturday.

Red Sox: Price (16-8, 3.81) looks to extend his career-best winning streak to eight games. He’s allowed two or fewer runs in his last six starts.