PHILADELPHIA (AP) — Andrew Knapp watched the ball roll toward Chicago's dugout and pulled up on his sprint down the basepath. He could stroll home on the wildest of walkoffs — a passed ball that kept the Phillies from dropping further in the NL pennant race.

Knapp scored when the ball knocked off Robinson Chirinos' mitt in the ninth inning to bolster Philadelphia's tenuous playoff push with a 6-5 win over the Chicago Cubs on Wednesday night.

“Sometimes, you're going to get punched in the face,” Knapp said. “We've been talking about just being able to flush everything and really focus on the next inning, the next pitch.”

The Phillies bullpen blew the lead in the eighth and ninth innings. Chirinos hit a two-run homer off Jose Alvarado that tied it 4-all in the eighth. Matt Duffy hit a solo shot off Ian Kennedy (2-1) in the ninth and tied it at 5.

The Phillies have 32 blown saves this season.

“We won the game. That's all that matters,” Phillies manager Joe Girardi said.

J.T. Realmuto, the All-Star game catcher playing first because of a sore right shoulder, led off the eighth inning with his 15th homer of the season in a topsy-turvy final two innings for a club clinging to playoff aspirations.

Knapp led off the ninth with a single off Trevor Megill (1-2) and advanced to third on a sacrifice and a groundout. Chirinos couldn’t get a handle on Megill’s knuckle-curve and Knapp scooted home with the winning run.

“It's hard to get crossed-up with nobody on second base,” said Cubs manager and former catcher David Ross. “Sometimes as a catcher, when you're a catcher and you're expecting the ball to break and it goes the other way, that can tip off your glove and get some funny spin on it which is tough to catch.”

The Phillies entered 4 1/2 games behind first-place Atlanta in the NL East and remained three games behind St. Louis in the wild-card race. San Diego and Cincinnati are ahead of the Phillies for the second wild card with 17 games left this season.

“I know that we can do it,” Knapp said. “I know that tonight's win is how we're going to have to do it.”

Time is running out for the Phillies to make a serious move, yet the schedule remained in their favor: After finishing their three-game set with the Cubs on Thursday, the Phillies play 10 straight games against teams with losing records. Then, a three-game set in Atlanta to close September.

“The interesting thing is that all the other teams are losing, too,” Girardi said. “So we’re still in this.”

Barely.

Alvarado wasted another solid outing by righty Ranger Suarez. He struck out a career-high eight over six innings. He made his 10th start of the season out of 37 appearances and has a 1.50 ERA over 90 innings.

The Phillies have leaned more on Bryce Harper to keep them in the race.

He led off the fourth with a double off Cubs starter Alec Mills and scored when Didi Gregorious hit into a double play. Freddy Galvis added a two-run homer, his 13th, later in the inning for a 3-0 lead.

Suarez gave two back in the fifth when New Jersey native Frank Schwindel — who had a hefty cheering section behind the Cubs dugout — hit a two-run homer that made it 3-2.

Suarez even helped himself when he doubled off Mills in the fifth and scored on Realmuto’s single for a 4-2 lead in the fifth.

The Phillies had lost six of seven and eight of 11 overall as part of a late-summer swoon that knocked them out of a short run in first place in the NL East.

Perhaps the Phillies aren’t as good as an earlier eight-game winning streak had teased?

“I don’t believe that, because we’ve won with this team,” Girardi said. “We have not played well lately. For whatever reason, we’ve blown some games late. There’s been some games where we haven’t hit. We’ve just been scuffling. And we have not been scoring a lot of runs lately. When you don’t do that, it’s harder to win games.”

FRANK THE TANK

Schwindel, from Livingston, N.J., and a St. John’s product, seemingly had several dozen fans going wild for him behind the Cubs dugout. At least one row spelled out “Frank the Tank” on the back of their white T-shirts.

TRAINERS’S ROOM

Phillies: Placed RHP Connor Brogdon on the 10-day IL with a right groin strain and recalled RHP Ramón Rosso from Triple-A Lehigh Valley.

JUST THE VAX

Girardi said the Phillies have reached an 85% vaccination rate, the percentage needed for relaxed health and safety protocols. That percentage includes players and staff in both the majors and Triple-A. Electronic tracing devices were eliminated.

UP NEXT

The Phillies are expected to throw a bullpen game in the series finale against Cubs RHP Kyle Hendricks (14-6, 4.54 ERA).

___

More AP MLB: https://apnews.com/hub/MLB and https://twitter.com/AP_Sports