By Sam Bush

Drew Smyly pitched seven solid innings, and the Phillies pounded the Mets 5-0 to end a three-game skid and pull ti within three games of a wild card spot.

César Hernández led off the game with his ninth homer, and Phils overcame the absence of star Bryce Harper a day after he was hit in the right hand by a fastball.

The Phillies are three games back of the Chicago Cubs for the second NL wild card with about three weeks left in the season. They entered the day tied with the Mets.

“I think we know that we’ve been written off, and we don’t care,” Phillies manager Gabe Kapler said. “We’re going to keep fighting.”

The Mets played sloppily behind Marcus Stroman (7-13), with third baseman Todd Frazier misplaying a popup and left fielder J.D. Davis letting a routine fly bounce out of his glove. The right-handed Stroman was pulled trailing 5-0 after four innings. He allowed 10 hits and struck out six without issuing a walk.

The Phils’ porous bullpen lost the club’s previous two games via walk-offs — including Nick Vincent’s bases-loaded free pass to Pete Alonso on Friday — but Smyly (4-6) left the relievers an easy task. He worked around three errors, including consecutive goofs by third baseman Brad Miller in the fourth, by limiting New York to four hits and striking out six.

“Smyly went out today and pitched like he didn’t have a care in the world,” Kapler said. “Like he had something to prove.”

The 30-year-old Smyly returned to the majors this year for the first time since 2016 following Tommy John surgery, but he was released by Texas in June and opted out of a minor league deal with Milwaukee in July. He signed with Philadelphia and is 3-1 with a 3.93 ERA in nine starts since.

“Physically, I feel really good,” Smyly said. “I feel like I’ve been getting on a roll. Three weeks left, and we all have to finish strong. Everyone in here knows where we’re at.”

Davis dropped Scott Kingery’s line drive leading off the fourth, and Kingery scored on Hernández’s single. Davis pounded his fist into his glove after Kingery crossed home.

“I just took my eye off the ball,” Davis said.

J.T. Realmuto and Corey Dickerson followed with RBI hits to lead 5-0. The Phillies’ 1-2-3 hitters — Hernández, Realmuto and Dickerson — were 8 for 9 with five RBIs against Stroman.