"They're the champs," DeRozan said. "We couldn't stop them. We couldn't slow them down when they got it going."
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.
Booed throughout by the sellout Toronto crowd, Bosh said he used the jeers as motivation.
"I was hearing a lot from the fans," Bosh said. "I thank them for continuing to stay on me and call me names and stuff because that helped my focus a lot. I was like 'I need to get in this to shut them up.'"
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.
"Chris really gave us a presence in the paint," Spoelstra said. "He hit the big 3 but he was collapsing the defense with his rolls to the rim, catching it and going up strong in traffic. That makes us a different team when he gives us that presence."
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.
NOTES: Gay made his first Raptors start in place of Landry Fields (back spasms). ... Miami is 24-2 when scoring 100 points or more. ... 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."