Sonny Gray of the Yankees walks to the dugout after...

Sonny Gray of the Yankees walks to the dugout after the sixth inning against the Red Sox at Yankee Stadium on Sept. 1, 2017. Credit: Jim McIsaac

Well, that good feeling didn’t last very long.

After beating the Red Sox on Thursday night to start a series Joe Girardi called the biggest of the season, the Yankees went quietly 24 hours later in a 4-1 loss in front of 43,332 at the Stadium.

The Yankees (71-63), who had 14 hits in Thursday’s 6-2 victory, managed only four against Doug Fister, Addison Reed and Craig Kimbrel and fell 5 1⁄2 games behind the AL East-leading Red Sox (77-58).

The Yankees have two games left this season against their rivals, who will pitch Drew Pomeranz (14-4) on Saturday afternoon and Chris Sale (15-6) on Sunday night. Masahiro Tanaka (10-10) and Luis Severino (11-6) will oppose them.

“I wouldn’t say that there’s no shot [at winning the division] if we don’t [win the next two],” Chase Headley said. “But we certainly feel the urgency that we need to win this series.”

The Yankees seemed to be taking a step toward doing that in the first Friday night, going ahead 1-0 on doubles by Brett Gardner and Aaron Judge to lead off the inning. But they did little after that.

After Jacoby Ellsbury’s two-out single in the second, Fister didn’t allow another hit until Headley bunted for a single with two outs in the seventh. The mostly soft-throwing 6-8 righthander, with a fastball-curveball-cutter combination the Yankees never timed consistently, allowed one run and four hits in seven innings.

Fister retired 16 of the last 18 he faced and did not allow a runner to get in scoring position after the first. “Doug Fister really pitches, that’s what he does. He doesn’t rely on power,” Joe Girardi said. “He just kept it off the barrel.”

Sonny Gray’s streak of starts in which he allowed two or fewer earned runs ended at 11 as he allowed four runs and five hits in seven innings. Gray, who walked one and struck out nine, allowed home runs by former Yankee Eduardo Nuñez — who irritated CC Sabathia the night before when he laid down a bunt — Andrew Benintendi and Hanley Ramirez. The Red Sox came in ranked 26th in the big leagues in homers with 142.

Gray (8-9, 3.36) fell to 2-4 with a 3.16 ERA with the Yankees. They have scored a total of three runs in the four losses, but he refused to lament the clear lack of run support. “Any time you go out there and you give up three homers, it’s tough on the whole team,” he said. “It kind of takes all the momentum or anything that you might be trying to put together and completely flips it and gives it to the other team.”

Gray entered the night having allowed 10 homers in 127 innings in his previous 21 starts. He allowed only two homers in 30 innings in his first five Yankees starts. He hadn’t given up multiple homers in a game since May 2, his first start of the season, when he surrendered three to the Twins.

“It’s hard to win games when your pitcher gives up three homers,” Gray said.

The most damaging came in the third when Nuñez golfed a 2-and-2 fastball over the wall in left for his eighth homer and a 2-1 lead.

Gray struck out the side in the fourth and retired the first two batters in the fifth before Benintendi crushed a first-pitch fastball to rightfield — it landed just short of The Judge’s Chambers — for his 19th homer and a 3-1 lead. The blast improved Benintendi to 9-for-18 with four homers and 11 RBIs at the Stadium this season.

Ramirez homered to right-center on Gray’s second pitch of the seventh to make it 4-1. The way Fister was going, it seemed like 14-1.

“We just couldn’t get anything going,” Headley said. “He really didn’t let us build any momentum.”

More Yankees headlines