NEW YORK (AP) -- Pete Alonso drew a bases-loaded walk with two outs to cap chaotic ninth inning and lift the New York Mets to a 5-4 win over the Philadelphia Phillies on Friday night.
The Mets pulled into a tie with Philadelphia, 4 1/2 games behind the Chicago for second NL wild card. The Cubs were playing at Milwaukee.
New York took a 4-2 lead in the bottom of the eighth on RBI singles by Alonso and Wilson Ramos. However, embattled closer Edwin Diaz (2-7), pitching for the first time since he gave up a walk-off three-run homer to Kurt Suzuki as Washington Nationals completed a seven-run ninth inning comeback Tuesday night, gave up a one-out, two-run homer to J.T. Realmuto in the top of the ninth.
However, the Mets bailed out Diaz in the bottom of the inning, when Mike Morin (1-2) retired the first two batters he faced before Juan Lagares singled to left-center. Lagares went to third when J.D. Davis, pinch-hitting for Diaz, got ahead 3-0 before singling to left on a full-count pitch
Nick Vincent then plunked Jeff McNeil with an 0-2 pitch to load the bases. Alonso walked on a full count and then had his uniform torn off by teammates as he reached first base.
Phillies right fielder Bryce Harper left in the third inning after he was hit in the right hand by a pitch from Steven Matz.
The Mets took the lead on McNeil's two-out RBI single in the third and Michael Conforto's leadoff homer in the fourth.
The Phillies tied it on Realmuto's RBI double in the fifth and Maikel Franco's run-scoring single in the sixth.
Phillies starter Zach Eflin allowed two runs and six hits with no walks while striking out six over five innings. Matz gave up two runs and six hits with three walks while striking out four over 5 2/3 innings.
Todd Frazier reached a milestone when he singled to center for the 1,000th hit of his career. Frazier was congratulated by first base coach Glenn Sherlock as the ball was tossed into the Mets dugout for safekeeping.
Frazier is the 82nd active player to reach 1,000 hits. Red Sox shortstop Xander Bogaerts entered Friday with 998 hits.
PLENTY OF HBPS TO GO AROUND
Bryce Harper became the 22nd player hit by a pitch in a Mets-Phillies game this season when he was plunked in the right hand by a fastball by Matz in the third inning. Harper remained in the game before being replaced by Sean Rodriguez in the bottom of the inning.
The Mets have been hit 15 times while the Phillies have been hit eight times.
While tensions boiled when Rhys Hoskins was brushed back twice by Jacob Rhame on Apr. 23 and again when Philadelphia right-hander Jake Arrieta hit three Mets on July 6, things remained calm Friday, when no warnings were issued and no other batters plunked before McNeil was hit with two outs in the ninth.
Phillies: Harper was diagnosed with a right hand contusion. Harper who sprawled to get out of the way of the pitch from Matz, remained on the ground for a few seconds clutching the hand before taking first base. He stayed in the game to run the bases before being replaced by Sean Rodriguez for the bottom of the inning.
Mets: INF Jed Lowrie (knee, calf) went 0 for 4 as the designated hitter for Single-A Brooklyn, which beat Hudson Valley 4-3 to advance to the New York-Penn League finals. It was the 12th rehab game since Aug. 20 for Lowrie, who signed a two-year deal in January but hasn't played in the majors due to a variety of injuries.
Phillies: LHP Drew Smyly (3-6, 6.65 ERA) will look to win back-to-back starts for the first time this season. Smyly has a 4.57 ERA in eight starts since joining the Phillies on July 21.
Mets: RHP Marcus Stroman (7-12, 3.28 ERA) is aiming to earn his second victory for his hometown team. Stroman, who grew up about an hour east of Citi Field, is 1-1 with a 4.55 ERA in six starts since being acquired from the Toronto Blue Jays on July 28.
More AP baseball: www.apnews.com/MLB and www.twitter.com/AP--Sports