Jason Vargas is still helping the Mets, even though he’s no longer with the team.

The former Mets starter, who was traded to Philadelphia before the trade deadline, allowed four runs in five innings in the Phillies’ 6-1 loss to the Diamondbacks in Phoenix.

The defeat helped the surging Mets, who now trail the Phillies (59-55) and the Brewers (60-56) by just a half-game for the second NL wild-card spot. The Mets are 59-56.

The Mets, who were eight games back in the wild-card race on July 24, are 13-1 in their last 14 games. The Phillies have a 6-7 record during that time.

Vargas fell to 6-6 as his ERA rose to 4.09. Bryce Harper hit a stat-padding solo homer in the ninth, his 20th, for Philadelphia.

“Are we still in the second wild card?” Harper said when asked to assess the state of the Phillies. “I’ll take it. If the season ends today then we’re in the playoffs. Just got to keep going, keep working.”

Rookie Zac Gallen (2-3, 2.60 ERA), who came to the Diamondbacks in a trade with the Marlins on July 31, didn’t allow a run in five innings and picked up the win for Arizona. He also helped himself with a run-scoring sacrifice bunt.

“I don’t get necessarily nervous when I pitch,” Gallen said when asked about his debut with a new team in a new ballpark. “When you pitch, you’re kind of in control most of the game. Was definitely a little amped up to get out there and make a good first impression, but it was nice.”

With AP