NEW YORK -- Bryce Harper grabbed his right hand on Friday night and lowered his head onto the shoulder of Mets catcher Wilson Ramos, searching for anything to remedy the pain from being smacked with a 92 mph pitch.

In an attempt to elude Steven Matz’s first-pitch sinker in the third inning of a 5-4 loss to the Mets, Harper dipped his head and raised his hands to cover his face. But the up-and-in pitch smacked his right hand.

Harper dropped to the ground and soon left the game with what the Phillies described as a “right-hand contusion.” X-rays were negative, but Harper’s hand was wrapped after the game and he said he could not grip a bat. His status for Saturday was uncertain.

If losing Harper was not enough of a blow to the team’s slim playoff hopes, the Mets delivered another punch in the ninth when Pete Alonso worked a walk-off walk against Nick Vincent.

For the third straight game, the Phillies lost after rallying to tie the game. J.T. Realmuto evened Friday night’s game at 4 with a two-run homer off Edwin Diaz on an 0-2 count with one out in the ninth. But his heroics were wasted. Late-game losses are not usually the best way to chase down a playoff spot.

“Of course it’s frustrating,” Realmuto said. “We’re not doing what it takes to win games. We’re playing OK. We’re staying in the game, but we’re not quite finishing it when we need to, you know? We’re right there in the last couple innings. Something always seems to happen where we don’t get it done pitching, we don’t get it done hitting. We’re just not quite getting it done. Especially this time of year.”

A Harper injury and a late-inning loss was a painful way to begin a crucial weekend that could define the team’s postseason chances. Friday night’s loss was the start of 20 straight games against teams with winning records. They missed a chance to pick up ground on the Nationals and Cubs -- both of whom lost -- and remained four games back of Chicago for the National League’s second wild-card spot.

The Phillies, according to FanGraphs, have just a 1.4% chance of making the playoffs. Those odds will only narrow if Harper’s hand keeps him out of the lineup. Manager Gabe Kapler said before the game that the Phillies will have to hit their way to the playoffs. And it’s hard to imagine them doing that without Harper, who is just one RBI shy from a career high.

“Of course, we’re in the stretch right now so if I can be in there, I’m going to be in there,” Harper said. “But I have to be careful, too.”

The Phillies could breathe a bit easier when Harper’s X-ray results did not reveal serious damage, but that did little to cover the sting of how the game ended. Mike Morin retired the first two batters of the ninth before allowing consecutive singles.

That prompted Kapler to insert Vincent, who was signed last month to a minor-league deal and called to the majors when rosters expanded on Sunday. The Phillies, Kapler said, liked Vincent’s cutter against Jeff McNeil. But Vincent plunked McNeil with his cutter after working an 0-2 count. The bases were loaded and Alonso walked on six pitches.

For the second straight day, the Phillies lost in a playoff race with a pitcher on the mound who was with Lehigh Valley a week ago. The success of this season will ultimately be defined by whether the Phillies play into October. And it was hard to imagine when the season started that players like Vincent and Jose Pirela -- who debuted for the Phillies with a start in left field -- would play key roles in a crucial September series.

“I talked to him after the game on the bench, told him not to hang his head because everybody here knows how tough that spot is he just got thrown into,” Realmuto said of Vincent. "He’s thrown three out of four with being sick in a day. I’m sure he’s a little tired, a little worn out. Everybody in this clubhouse knows that’s a really tough spot he was just put in. "

Pirela set a franchise record by being the 55th player used this season as the Phillies surpassed the 54 hey used in 1996 during a forgettable 95-loss campaign. He had not played in the majors since April, but Kapler thought the right-handed utility player gave the Phillies a better chance against the left-handed Matz than left-handed options Corey Dickerson or Adam Haseley. Pirela went 1-for-3 with a walk and a bloop single that dropped into shallow right field, just beyond the infield dirt.

“I think we put together the best possible lineup to win the game,” Kapler said.

They left nine runners on base and squandered chances with the bases loaded in two innings. The missed chances, it seemed, would eventually burn them. Finally, they did.

The Mets scored twice in the bottom of the eighth to rally past the Phillies bullpen. Alonso greeted Hector Neris -- who stayed in the bullpen for a few extra warmup throws after Kapler called on him -- with an RBI single. Ramos, the former Phillie who comforted Harper, singled in another run two batters later.

Zach Eflin allowed two runs on six hits in five innings as he faced the Mets for the second time in five days. He has a 2.50 ERA in his last three starts as he has found success ever since he began throwing his two-seam fastball. He could have pitched deeper into the game had the Phillies not had to hit for him with the bases loaded in the sixth inning. That chance was squandered, too.

“It’s extremely disappointing,” Kapler said. “We had an opportunity to win that game there and didn’t capitalize. Very difficult.”

The Phillies were still six innings away from defeat when Harper lifted his head off Ramos’ shoulder, had his hand inspected by the team’s training staff and moved to first base. He stayed in the game for a few more minutes before retreating to the Phillies dugout after an inning-ending double play wasted another chance. His hand was throbbing.

Sean Rodriguez grabbed his glove, jogged up the dugout steps, and ran to right field to replace him. The Phillies held their breath as their ever-so-slim playoff chances seem to be resting on Harper’s right hand.