The Lightning appeared headed to their ninth loss in 12 games, trailing 3-0 after two periods. Boyle changed the momentum with two goals in the first 2:29 of the third.
After assisting on Vincent Lecavalier's power-play goal that tied the score at 5:56, Boyle completed his first career hat trick on a wrist shot from the slot to make it 4-3 with 8:57 left.
New York got goals from Martin Straka, Blair Betts and Aaron Ward. The Rangers also blew a lead in their previous game, allowing three goals in the third period of a 3-2 loss at Florida on Thursday night.
The Rangers have lost a season-high five straight.