Toronto ended a two-game skid despite missing Bargnani, who had an appendectomy earlier in the day and remains hospitalized. There is no timetable for the No. 1 pick's return.
"I've been thinking about this game for quite awhile," said Bosh, who had a career-high 41 points the last time he faced Howard.
"We knew we weren't going to have Andrea tonight. I knew I was going to have to try and control the tempo."
Bosh went 10-for-21 from the field and 14-for-16 from the line in 46 minutes.
When the young All-Stars last met on Feb. 7, Howard went 13-for-14 from the field for a career-high 32 points.
"I like playing against my friends because I think we bring the best out of each other," Bosh said.
Grant Hill had 24 points and Howard had 17 points and 12 rebounds for the Magic, who haven't won consecutive games since Jan. 31 and Feb. 2.
T.J. Ford had 16 points and 12 assists for the Atlantic Division-leading Raptors, who moved six games ahead of New Jersey.
"He always plays great against this team," Ford said of Bosh.
Toronto did a good job of keeping Howard away from the basket in the first half as Howard had just two rebounds and seven points.
Bosh had 16 points and 12 rebounds in the first two quarters, including a number of impressive dunks. Toronto led by five at halftime.
The two guarded each other more in the second half. Bosh's jumper over Howard gave Toronto an 83-74 lead with 2:29 left
Jameer Nelson's three free throws cut Toronto's lead to six with 2:41 remaining, but Bosh followed with a hook shot with 1:53 left.
Keyon Dooling stole Bosh's pass, but Bosh ran down the court and blocked Dooling's layup. After Dooling got a technical for yelling at the official, Ford made a free throw and Bosh made two more to give Toronto a 88-78 lead with 36.3 seconds left.
Nelson followed with two consecutive 3-pointers to cut the lead to four, but Juan Dixon made four free throws in the final 20 seconds.
"It's a little frustrating to let a game like this slip away," said Howard, who missed two late free throws. "If I would have made them it would have kept us in the game."
Toronto outrebounded Orlando 55-38. ... Bosh said Bargnani should take his time getting healthy. "If he has to miss the rest of the season than that's the best thing for him," Bosh said. ... Toronto backup point guard Jose Calderon missed his third straight game with a sprained left ankle. ... Toronto's Anthony Parker has missed seven of the last 11 games with a sprained right ankle