Looking for every extra edge in a playoff chase, the Philadelphia Phillies tried most everything — stealing and bunting, plus plenty of pinch-hitters and pitchers.

On and on they went, mixing and matching against the Mets for so long the teams actually began to run out of baseballs.

In the end, the Phillies had just enough.

Maikel Franco, Scott Kingery and Adam Haseley homered as Philadelphia overcame an early deficit and outlasted the Mets, 10-7, on Sunday to further tighten the National League wild-card race.

“It wasn’t the prettiest win by any stretch,” Phillies Manager Gabe Kapler said.

The game took 4 hours 29 minutes — a minute short of matching the longest nine-inning game in N.L. history. When it was over, Philadelphia had closed within two games of Chicago for the second wild-card spot. The Mets stayed four back of the Cubs, who lost to Milwaukee, 8-5.