Chester, PA – Sebastien Le Toux scored his eighth and ninth 2 on Thursday night.
Le Toux scored in the 4th and 15th minutes as the Union jumped out to an early lead, but Dwayne De Rosario scored his league-leading 14th goal and Andy Najar also scored before half for D.C., setting up Farfan's game-winner in the 57th.
Philadelphia (10-7-13) surged from fourth to second in the Eastern Conference, as it won for the second time in its last three during a five-match undefeated streak. The Union have played one less game than leader Sporting Kansas City.
United (9-8-11) failed again to win back-to-back games, as it remains just one of three teams - the New England Revolution and Vancouver Whitecaps FC the two others - yet to win two straight matches all season.
Philadelphia got off to a great start at PPL Park, as Le Toux scored less than 4 minutes into the match. He gained possession of the ball after it deflected off a United defender, then beat D.C. goalie Bill Hamid from 15 yards.
Le Toux added his second goal in the 15th as he turned a pass from Farfan into the top-left corner for his 10th goal of the season.
United did not fold, as De Rosario added another goal to his MVP resume in the 22nd. Austin Da Luz delivered a corner to the near post and De Rosario shook off his defender to head a one-hopper in past Union goalie Zac MacMath.
Najar, the MLS Rookie of the Year last season, pulled United even on the half- hour following a run of more than 80 yards, which ended with a great finish to the bottom-right corner. Hamid earned an assist for his outlet pass.
Farfan secured all three points for Philadelphia early in the second half when United defender Ethan White gave him too much space just outside the area, and the Union midfielder picked out the top-left corner from 18 yards.
While Philadelphia took a major step toward securing a postseason spot in just its second season, United remained one point out of the final playoff berth.
In addition to the loss, D.C. lost De Rosario in the second half to an unknown injury, making the one or two matches United has in hand on every squad in the East less important should he miss any time.
United visits Columbus on Sunday for the first of five games in October, while Philadelphia visits Chivas USA on Sunday for the first of three road games in its four-match final month of the season.