Dwyane Wade added 23 points as the Heat bounced back after Friday's 102-89 loss at Indiana, ensuring their team Super Bowl viewing party would be a happy one.
James finished with team highs of eight rebounds and seven assists and Bosh scored 13 in the fourth quarter for Miami, which improved to 12-11 on the road.
Terrence Ross and DeRozan sandwiched 3-pointers around a hook shot by Bosh, bringing Toronto to within three at 84-81 with 5:22 left. Miami's Norris Cole scored a layup but DeRozan answered with a driving dunk, and Miami called timeout up 86-83 with 4:09 left.
Bosh made one of two from the line after the stoppage, then followed with a 3 from the corner as the Heat took a 90-83 lead with 2:34 to go.
James extended the lead by stealing the ball on Toronto's next possession and driving for a breakaway slam, then hitting a 3 to put the Heat up 95-83 with 1:28 left.
James scored nine points in the first, including an alley-oop dunk from Mario Chalmers and a breakaway slam off a Raptors turnover. DeRozan had 10 for Toronto but the Raptors trailed 24-21 after one quarter, the first time in nine games they hadn't led after 12 minutes.
Gay scored Toronto's first 10 points of the second to give the Raptors the lead. He finished with 16 in the quarter, putting Toronto up 50-44 at the half. Bosh scored nine points in the third and Wade added seven as the Heat took advantage of six Toronto turnovers to take a 71-67 lead into the fourth.
James had indicated his displeasure last Wednesday after realizing he would miss the Super Bowl while flying back to Florida after the game. The Heat's private plane is not equipped with satellite TV or wireless Internet.
To accommodate James, the Heat delayed their return home for Monday's game against Charlotte until after the Super Bowl, which they planned to watch at a bar adjoining the Air Canada Centre. Real Sports Bar and Grill is operated by Raptors team owner Maple Leaf Sports and Entertainment.
Notes: Gay made his first Raptors start in place of Landry Fields (back spasms). ... This was the last of a four-game road trip for the Heat. Monday's game against the Bobcats is the first of five straight at home. They'll also face Houston, the Clippers, the Lakers and Portland. ... James and several Heat teammates attended Saturday night's NHL game between the Maple Leafs and Boston Bruins. James tweeted a photo from his seat accompanied by the caption ''At my first hockey game. Pretty Damn cool.''