The Phillies lost for just the fourth time in their last 15 games but fell 1 1/2 games behind Florida in the National League wild card race. The Marlins got a run in the bottom of the ninth to beat the Braves 5-4 Friday night to boost their wild card lead.
Wells (8-8) won for the third time in his last four starts by limiting the Phillies to two runs - one earned - and four hits in 6 2/3 innings. The right-hander walked two and struck out seven.
After Wells departed, Sanders provided some insurance with two outs in the bottom of the seventh with his homer off Jose Mesa that opened an 8-2 lead.
Phillies starter Amaury Telemaco (1-3) was roughed up for five runs and seven hits in 5 1/3 innings. The bullpen didn't help much either. Dan Plesac allowed runners to reach the corners with two outs in the seventh and Jose Mesa entered to surrender the homerun to Sanders.
Jim Thome hit a two-run homer in the eighth. He became the first Phillie to hit 40 homers in a season since Hall of Famer Mike Schmidt finished with 40 in 1983.
After Tomas Perez's run-scoring single with two outs in the top of the second opened the scoring, Craig Wilson plated the tying run with a groundout in the bottom of the inning.
Abraham Nunez gave the Pirates the lead when he opened the bottom of the fourth by sending a 1-1 pitch over the right field wall for his fourth homer. The Pirates extended their lead when Wells helped his own cause in the fifth by bouncing into a forceout to plate a run, giving the Pirates a 3-1 lead.
In the sixth, pinch-hitter Jose Hernandez snapped out of an 0-for-26 funk by lacing a two-run single off Valerio de los Santos.
The Phillies attempted to climb back into the game in the seventh. Pinch hitter Jason Michaels drew a base-loaded walk with two outs but Mark Corey got Marlon Byrd to fly out to shallow left field, ending the inning.
With two runners and two outs in the bottom of the inning, Sanders crushed a 2-2 pitch from Mesa over the right-center field wall for his 31st homer, giving the Pirates an 8-2 lead.
Thome capped the scoring with his homer with one out in the eighth off Corey.
The series continues Saturday with Kevin Millwood (14-10, 3.74) going against Josh Fogg (9-8, 4.76). The Marlins and Braves continue their series with Russ Ortiz (19-8, 3.82) going for Atlanta against Dontrelle Willis (12-6, 3.28) for Florida.