MIAMI — Thursday night had yet to blur into Friday morning when Travis d’Arnaud felt the weight of his legs dragging him down. The Mets catcher had been behind the plate for 10 innings, and he would catch six more, before he finally ushered in the end.

With the benches empty and the bullpen burned out, d’Arnaud blasted a solo home run in the 16th inning, just enough to lift the Mets to a 9-8 victory over the Marlins.

“The emotions of the homer helped lift my legs a little bit,” said d’Arnaud, who had four RBIs and a career-high four hits as the Mets won their fifth straight. They homered for the ninth straight game and had a total of four home runs.

Yoenis Cespedes staged another prodigious display of his power, slamming a pair of towering home runs. Wilmer Flores went back-to-back with Cespedes in the third. But Cespedes’ second multi-homer effort in three games was not enough on its own to absolve the Mets.

It took a clutch swing from d’Arnaud and 11 2⁄3 innings of scoreless relief from the Mets’ bullpen. The last two came from Hansel Robles, who tossed two scoreless frames despite pitching for the fourth straight game.

Manager Terry Collins was so set against using Robles that he was prepared to have catcher Rene Rivera pitch in relief. He had entered the game to play first base. Had Rivera gone to the mound, Zack Wheeler would have played first.

advertisement | advertise on newsday

Instead, Robles called down to the dugout to inform Collins that he was willing to pitch.

“Ultimately, I felt good,” Robles said through a translator. “And that’s why I decided to give them a call.”

He entered in the 15th, the last available reliever. And it was Robles who stood on the mound in the 16th, when Marcell Ozuna — who had hit a grand slam in the first inning — lifted a fly ball to the warning track in center that was only a few feet away from being a walk-off homer.

“We did have a little scare,” said Robles, who pitched to Ozuna although the Marlins had the pitcher on deck. “But thank God we’re here.”

The Mets emptied their bench. The night dragged on so long that starting pitcher Jacob deGrom was summoned for pinch-hitting duty in the 15th. He struck out. But the Mets won their longest game since needing 18 innings to beat the Cardinals, 3-1, on July 19, 2015.

Mets videos

The Marlins resorted to using Adam Conley, who was slated to start Friday night. It was Conley who served up d’Arnaud’s homer.

“They rose up, they hung in there, they’re dog tired,” Collins said. “Pretty impressive game to win.”

The Mets rallied from an early deficit, opened a lead of their own, then squandered it. But Michael Conforto’s tying RBI double off the bench in the eighth forced extra frames.

Robert Gsellman got shelled for eight runs and five hits in 4 2⁄3 innings, leaving a heavy workload for a bullpen that already has been taxed to start the season. After an impressive spring training in which he seized a spot in the starting rotation, he has seen his ERA rise to 9.28 in his first two starts.

Gsellman encountered trouble from the start. He ended the first inning trailing 4-0 after Ozuna’s grand slam. But the Mets answered with four runs of their own in the second, a rally that was kept alive when Jay Bruce bunted against the shift. The biggest hit came from d’Arnaud, who lined a bases-loaded triple down the rightfield line. He scored the tying run on Curtis Granderson’s single.

advertisement | advertise on newsday

After Cespedes and Flores hit back-to-back homers in the third for a 6-4 lead, Cespedes struck again in the fifth, launching another solo shot for a three-run lead.

Gsellman settled into a rhythm after the first inning, retiring the next 10 hitters he faced. That stretch included five strikeouts. It was perhaps the first time this season that he looked like the promising fireballer who bailed out an injured rotation in the second half of last season.

But with the bases loaded in the fifth, Gsellman walked Christian Yelich to force in a run and Giancarlo Stanton lifted a sacrifice fly to make it 7-6. Josh Edgin surrendered an RBI double by Justin Bour that tied it at 7 and Derek Dietrich added an RBI single to right to put the Marlins ahead 8-7. It would have been worse for the Mets had Bruce not cut down Bour trying to score.

The Mets thought they had tied it in the seventh. Cespedes struck out but reached on a wild pitch. With two outs, Bruce singled to left and Cespedes busted home trying to score from second. He apparently scored standing up, but the call was overturned when replay showed that catcher A.J. Ellis grazed Cespedes before he touched the plate.

Jerry Blevins wriggled out of a bases-loaded jam in the seventh. Fernando Salas, who has pitched in seven of the Mets’ 10 games, tossed two scoreless innings after Conforto tied it. Addison Reed added two shutout innings of his own ahead of Josh Smoker, who set a career high with his three scoreless frames.

advertisement | advertise on newsday

“I’m glad we won, “ Smoker said through his exhaustion. “We play this game to win.”