Nationals closer Sean Doolittle gathers himself after the Mets’ Todd Frazier tied it with a three-run homer in the ninth inning. Michael Conforto won it later with a two-out RBI single. (Mike Stobe/Getty Images)

Sean Doolittle walked off the mound and toward the dugout, stunned. The Washington Nationals closer had, for the second time in three months, allowed four runs in a blown save against the New York Mets. Friday night was the sixth time this season the Nationals had led or were tied in the eighth inning against the Mets, only to lose.

“I don’t have a lot of answers right now,” Doolittle said. “I’m kind of searching, going over the inning in my head.”

The Washington team that arrived here Friday was supposed to be different. The Nationals had established themselves as legitimate playoff contenders with a retooled bullpen, adding three relievers at the trade deadline for series such as this. One of those acquisitions, Daniel Hudson, bridged seven strong innings from starter Stephen Strasburg to the ninth. The Nationals had a three-run lead and Doolittle, their most trusted reliever, on the mound. It should have meant game over, and it did — just not how the Nationals had hoped.

Before he managed to record an out, Doolittle allowed a game-tying, three-run homer to Todd Frazier. Five batters later, Michael Conforto’s two-out RBI single rocked Citi Field and the Nationals, who were saddled with a painful, 7-6 loss.

Manager Dave Martinez thought Doolittle struggled to keep his fastball up, but more than anything, he trusted his reliever. Martinez never entertained the idea of removing him.

“He’s our closer; that’s what he does,” Martinez said. “It was unfortunate, but come tomorrow, I’ll see how he feels, and he’ll be right back out there.”

The loss dropped the Nationals to 61-54, prevented them from reaching nine games above .500 (which would have tied a season high) and cut into their cushion atop the National League wild-card race. The Mets improved to 60-56, earned their seventh win in a row (as well as their 14th win in their past 15 games) and are within a half-game of Milwaukee for the second wild-card spot.

Doolittle didn’t seem to think the ball staying up was his problem. The one thing he attributed his struggles to was how the ball came out of his hand. He looked up at the scoreboard a few times and saw 91 or 92 mph for his fastball, a few ticks below his average. The left-hander suspected he might have overthrown a bit, tried to do too much.

Whatever it was, the Mets saw the ball well. Doolittle struggled to get ahead in the count because the Mets attacked early and often. He only got two swings and misses. The entire blowup took only 26 pitches. Doolittle tweaked his knee moving off the mound in the inning but later said he was fine. He waved off the notion that his heavy workload might have been the root cause for the result. Other than a home run he allowed at home against the Atlanta Braves, he has felt “great” in the past few weeks.

“No, no, I’ve been feeling really good,” Doolittle said. “My outings on this road trip . . . I feel like I’ve been happy with how I’ve been throwing the ball. Tonight, for some reason, I didn’t have it.”

The stakes for this game seemed improbable if not impossible 77 days earlier, when these teams were competing to see whose season looked bleaker. On May 23 — a date that would come to define the Nationals’ season because of how they played after it — the Nationals crawled away from Citi Field following a humiliating sweep. At 19-31, they had their worst record since the pre-2011 dark days. Martinez seemed on the brink of being ousted. The issues that had plagued the team all season manifested with an injured offense totaling 13 runs and a combustible bullpen allowing its 40th run to the Mets in 37 2/ innings.

Since, the Nationals had gone 42-22 entering Friday. Then old demons reappeared.

“I absolutely love the way the guys played,” Martinez said. “We did everything right until the ninth inning. Just got to keep pounding. Like I told them before, ‘Hey, we come back tomorrow, we got 1-0, and move on.’ ”

The game began as a pitchers’ duel. Mets starter Marcus Stroman, the team’s top trade-deadline acquisition, struck out seven hitters in the first three innings, and Strasburg one-upped him by retiring the first nine batters he faced. Both took damage in the fourth.

Stroman allowed an RBI triple to Anthony Rendon and a two-run homer to Juan Soto, who equaled his rookie season home run total of 22. Soto hit Stroman’s 90-mph cutter so hard that the right fielder barely moved, and Soto bat-flipped even harder. In the dugout, he shimmied his shoulders in what appeared to be an imitation of a move Stroman had done after an earlier strikeout.

In the bottom half, Strasburg issued a leadoff walk and allowed those back-to-back home runs. The score was tied at 3.

In the sixth, the Nationals and Mets both put runners on first and third with no outs, and neither team scored. It was a coincidence until the situation surfaced again in the ninth (when the Nationals scored an insurance run) and didn’t end the same way.

It seemed, for so long, like the Nationals’ game. They jump-started what looked like a game-winning rally in the seventh against Stroman, the pitcher brought in to win games such as this. Stroman walked leadoff hitter Trea Turner, ending his night. Two batters later, Rendon sent Justin Wilson’s first pitch to him over the wall in left, giving the Nationals a 5-3 lead. Citi Field had felt like the epicenter of a pennant race until that moment. The crowd fell silent — until Frazier’s home run jolted it back to life two innings later.

Later, as Doolittle drew closer to the dugout, he thought for the first time about his previous blown save against the Mets. So much had changed since the last time these teams played at Citi Field — everything except the result, anyway.

“It wasn’t like I came in here looking to exorcise any demons or anything like that,” he said, then paused. “But walking off the field with that same sick feeling . . . it was kind of surreal.”