The Maple Leafs won for just the 10th time in 32 games since the All-Star break.
Tampa Bay took a 2-1 lead midway through the third period on the 59th goal of the season from Steven Stamkos, who will finish the season as the league's runaway leader in goal scoring.
Jake Gardiner tied it by tipping in a shot with 2:55 to go in regulation and Phaneuf ended it with a tip-in of his own on a shot by Phil Kessel.
Stamkos needs one more goal in Tampa Bay's final regular-season game to become the first player in four seasons to reach the 60 mark. Alex Ovechkin of Washington was the last to do so.
Ben Scrivens got the win by making 35 saves. Dwyane Roloson gave up three goals on 31 shots.