James van Riemsdyk had three assists to help the Flyers win their fourth straight. They also beat the Islanders in overtime Saturday.
Nick Leddy, Josh Bailey and Matthew Barzal scored for the Islanders. They have lost five in a row.
After Barzal was whistled for high-sticking in overtime, Philadelphia took advantage. Claude Giroux set up Hayes, who shot high past Ilya Sorokin from close range.
Farabee scored the first of his two second-period goals on a one-timer from the left circle that went high over Sorokin's right shoulder to give Philadelphia a 2-1 lead. The 20-year-old forward completed his first career hat trick with 4:08 left in the period on a deflection in front of Phil Myers' wrist shot.
The Islanders tied it with two goals in the first 6 1/2 minutes of the third.
Bailey tipped home Ryan Pulock's shot from the point 1:03 into the third. Then, Barzal tied it with 13:33 remaining on a one-timer from the slot that beat Brian Elliott to the glove side.
Sorokin kept it tied in regulation when he robbed Giroux with 2:53 left with a pad stop.
Farabee got Philadelphia on the board with 1:18 left in the first when his wrist shot from the slot beat Sorokin on the glove side. Scott Laughton's hustle play to negate an icing violation led to the goal, which was set up when Van Riemsdyk deflected a clearing attempt right to Farabee.
After scoring eight goals in 52 games as a rookie, Farabee has five in 10 games this season.
The Flyers and Islanders combined to hit the post or crossbar four times. Hayes twice drew iron and teammate Travis Konecny hit the post. Islanders' Michael Dal Colle also had a shot clank off the post.
HOME SWEET HOME
The Islanders finally return home on Tuesday night after five straight on the road, and coach Barry Trotz is looking forward to familiar surroundings -- and getting out and about a bit. While saying he wasn't complaining, Trotz admitted that quarantining on the road can be challenging.
"You're sort of a hostage in your own hotel a little bit," he said. "It does get a little numbing."
Islanders: Host Buffalo on Tuesday night.
Flyers: Host Boston on Wednesday night.