16 INNINGSMets 9 – Phillies 8 The clock read 12:33 a.m. when Carlos Beltran leapt onto home plate into the waiting arms of his teammates. Even at that crazy hour, 16 never seemed so sweet.

Beltran’s leadoff homer in the bottom of the 16th capped the longest game in the majors this season, delivering a 9-8 come-from-behind victory over the Phillies.

Beltran pulled a 2-2 fastball off Philly righty Ryan Madson, who was entering his eighth inning of relief. The Mets center fielder flipped the bat after he pummeled the 92-mph heater deep to right, knowing he had just capped the marathon after five hours and 22 minutes.

“I hit it real, real good,” he said. “I just wanted to go home.

“I felt so great that the game was over.”

Said Madson: “I never thought I would go [that far]. I felt better later. I thought I could get the fastball by him.”

A hardy crowd that remained from the 28,958 stood during the bottom of innings hoping for a walk-off shot, and they were rewarded. With the comeback win, the Mets (27-17) moved four games up on Philly in the NL East.

It was the longest game the Mets had played since June 16, 1995, versus Houston in a 7-5 loss. Beltran’s third career walk-off homer gave the Mets their sixth walk-off win of the season.

“You use all your players and play a gut-wrenching game like that, you have to win those games,” manager Willie Randolph said. “Those games can sometimes stay with you.”

Jose Reyes lined a two-out, two-run, game-tying homer off righty Ryan Franklin in the eighth on a 0-2 count, bringing the Mets all the way back from a 6-2, fifth-inning deficit. It was one of many improbable turns for the Mets, although it was Reyes’ fourth homer of the season.

“I’ve been in the weight room,” he joked.

Then the two teams went scoreless until into the morning, with Madson going inning after scoreless inning for the Phils and a host of Mets relievers doing the same. Darren Oliver earned the win with four scoreless frames.

The NL East leaders had climbed back into a tie due to spotty defense by Philly, which seemed on the way to a victory with a four-run lead after 4 ½ innings thanks to a three-run bomb by David Bell in the fifth.

With the Mets within 6-5 after a run in the fifth and two more in the sixth, the normally dependable Aaron Heilman allowed Bell’s two-run double, which made the comeback more difficult.

With two outs and nobody on in the eighth, Endy Chavez – a late replacement for Xavier Nady, who was scratched with lower back stiffness – beat out a chopper to first when Franklin dropped a feed from first baseman Ryan Howard to spark the three-run rally.

Pinch-hitter Chris Woodward ripped an RBI double to left, and Reyes followed with his fourth homer of the season, a scud which barely cleared the fence in right.

In 44 games, the Mets have already played extra innings eight times. They have 11 come-from-behind wins and eight wins in their last at-bat, none more welcome than this one.