PHILADELPHIA (AP) Sean Rodriguez answered the critics with one big swing.
Josh Bell hit a solo homer off Philadelphia closer Hector Neris to tie it at 5 in the ninth after Corey Dickerson delivered a two-run shot against his former team in the eighth to give the Phillies a one-run lead.
But after stranding five runners in the ninth and 10th, the Phillies won it when Rodriguez went deep against Michael Feliz (2-4) for his fourth career walk-off homer. Rodriguez was in a 1-for-21 slump before he connected.
''Think about it. Who is looking bad and feeling entitled when you hear stuff like that?'' Rodriguez said about the criticism. ''I'm not the one booing. I'm not the one screaming. I'm not the one saying pretty disgusting things at times. That seems pretty entitled. You're just making yourself look pretty bad as an individual, as a person, as a fan. ... There's still a lot of good fans, though, and those are the ones I hear.''
Philadelphia moved within a game of the idle Chicago Cubs for the second NL wild card.
Bryce Harper launched a solo homer to right field with two outs in the eighth in his first game back from paternity leave to cut it to 4-3. After J.T. Realmuto's infield single, Dickerson ripped one out to right to give the Phillies a 5-4 lead.
Dickerson, acquired from the Pirates before the July 31 trade deadline, has 21 RBIs in 19 games for the Phillies.
Bell has been slumping and wasn't in the starting lineup but he crushed a 432-foot homer off Neris for his 33rd this season. Neris has five blown saves in 28 chances this season.
Rhys Hoskins fouled out with the bases loaded and one out in the ninth and heard a chorus of boos as he walked to the dugout. Harper struck out swinging at a 3-2 pitch to send it to extra innings.
''I could care less about that,'' Hoskins said of the boos. ''We won the game.''
Mike Morin (1-0) tossed two scoreless innings for the win.
Phillies starter Jason Vargas allowed four runs and seven hits in six-plus innings.
''This one was a must-have,'' Vargas said. ''Guys came up big. Sean came up big there. We just fought to the end.''
Pirates starter Joe Musgrove gave up two runs and five hits, striking out six in six innings.
Kevin Newman's two-run single off reliever Jared Hughes in the seventh gave the Pirates a 4-2 lead.
Brad Miller slammed an opposite-field, two-run shot in the fourth to give the Phillies a 2-0 lead. Miller was only 4 for 27 with two RBIs since his last homer on July 16.
The Pirates cut it to 2-1 in the fifth when Adam Frazier ripped a double with two outs and Musgrove smacked an RBI single off the left field wall.
NO RUN ZONE
Realmuto threw out three runners trying to steal second base. He has nailed 33 of 75 runners trying to steal this season.
Phillies 2B Cesar Hernandez wasn't in the starting lineup because he didn't run hard on a ball off the wall in Sunday's 3-2 loss at Miami. Hernandez thought he hit a homer and settled for a single when it didn't go out. He scored when Hoskins followed with a homer. Manager Gabe Kapler said: ''It's not a punishment. It's a response.''
Harper returned following the birth of his son, Krew Aron. 3B Maikel Franco was optioned to Triple-A Lehigh Valley to make room on the roster.
Phillies: INF-OF Scott Kingery left the game with abdominal soreness but Kapler said after the game it was gastrointestinal and not a muscular injury. ... OF Jay Bruce (left flexor strain) is scheduled to play two rehab games Friday and Saturday. ... RHP Pat Neshek (hamstring) is considering an injection and possibly surgery.
LHP Drew Smyly (2-6, 6.99 ERA) starts for the Phillies and LHP Steven Brault (3-3, 3.98) goes for the Pirates on Tuesday night.
More AP MLB: https://apnews.com/MLB and https://twitter.com/AP-Sports
Copyright 2019 by STATS LLC and Associated Press. Any commercial use or distribution without the express written consent of STATS LLC and Associated Press is strictly prohibited.