The Phillies, with ace Aaron Nola seemingly in total command, had a foundering New York Mets team that had lost six in a row, truly frustrated.

Nola had pitched six shutout innings, but the seventh inning wasn’t very kind, the eighth inning was much worse, and the ninth was no bargain either.

For one night, the Mets got back on course and the Phillies dropped another game in their wild-card pursuit with Friday’s 11-5 loss before 30,503 at Citizens Bank Park.

The Phillies are now 3 1/2 games behind the Chicago Cubs for the second wild-card spot with 29 games remaining.

The Mets are five games behind the Cubs.

Nola would only get one out in the seventh.

J.D. Davis walked and Joe Panik singled to open the inning, putting runners on first and second. After an Amed Rosario pop-up, Todd Frazier was hit by a 78 mph knuckle curve to load the bases.

Pinch-hitter Wilson Ramos, a former Phillie, then hit an RBI single to center to tie the score a 1-1 and extend his career-best hitting streak to 23 games.

“He [Nola] put a changeup in the middle of the plate, Ramos didn’t crush it but was able to put it in the outfield, and that was enough,” Phillies manager Gabe Kapler said.

Nola was replaced by lefty Jose Alvarez, who escaped further damage by getting pinch-hitter Rajai Davis to line out to shortstop Jean Segura and Jeff McNeil to pop up to Scott Kingery at third base.

Alvarez’s heroics couldn’t be duplicated by the rest of his bullpen mates.

Mike Morin opened the eighth inning, but he was knocked out after Rosario hit a two-run single up the middle to give the Mets a 3-1 lead.

“I threw a pretty decent slider down and away and Rosario just punched it through the middle,” said Morin, who left with two runners on base.

Morin was replaced by Jared Hughes, who promptly served a three-run homer to Frazier, extending the Mets’ lead to 6-1.

“I am definitely better when I am ahead of the count and fell behind 1-0, and he just sat on that pitch and got it,” Hughes said of Frazier.

Adding to the bullpen misery, Edgar Garcia allowed a two-run homer to Michael Conforto and a three-run shot by Frazier in the ninth.

Frazier tied a career high with six RBIs.

The Phillies scored four in the ninth on Dickerson’s RBI single, J.T. Realmuto’s sacrifice fly and RBI doubles by Bryce Harper and Rhys Hoskins.

Nola allowed just one run in 6 1/3 innings and his counterpart Zach Wheeler gave up just one run in six innings.

Nola said he wasn’t fatigued in the seventh inning.

“I felt fine, I was just missing a little bit,” he said.

The Phillies had taken a 1-0 lead in the fifth. Adam Haseley opened with a single, was sacrificed to second by Nola and went to third on a Dickerson single to right.

Realmuto then hit a sacrifice fly to center for the first run. Conforto made a running, diving catch, got up and made a strong throw, but he couldn’t nail a sliding Haseley at the plate.

After Harper walked to put runners on first and second, Hoskins singled to center and left fielder J.D. Davis threw out Dickerson on a one-hopper at home.

The Phillies were unsuccessful in challenging the ruling. It was a harbinger of things to come.