Toronto saw a 20-point lead in the second half dwindle to one midway through the fourth quarter, but did just enough down the stretch to upend the Rockets for a seventh straight time at Air Canada Centre.
Greivis Vasquez made four of Toronto's 10 3-pointers and finished with 15 points, as did Jonas Valanciunas for the Atlantic Division leaders, who are 2 1/2 games ahead of the second-place Nets.
The Rockets have dropped three straight with All-Star center Dwight Howard out of the lineup due to an ankle injury and hold just a one-game advantage over the Portland Trail Blazers for fourth place in the West.
Houston never led in the second half and was trailing by 20 before embarking on an 18-8 flurry over the final 3:29 of the third quarter, which ended with Houston's backup center, Donatas Motiejunas, missing a dunk before the buzzer.
The momentum stayed with the Rockets early in the fourth, and Omer Asik's three-point play pulled them within 92-90 with 8:45 to play.
Jeremy Lin missed a potential go-ahead 3-pointers the next time down, and Harden spoiled a chance at evening things by going 1-of-2 at the foul line.
DeRozan answered with a tough pullup jumper, and after Harden again split a trip to the foul line, Terrence Ross and Patrick Patterson scored inside to push Toronto's lead to 98-92.
The Rockets pulled within one possession with a Harden bucket and an Isaiah Canaan free throw, but Ross countered with a 3-pointer and the Raptors held on over the final three minutes.
The Rockets jumped out to a 12-point lead in the first quarter and were ahead 25-14 before the Raptors, after missing eight of their first 12 shots, went on an 11-0 run that stretched into the second frame.
DeRozen ended the half with a buzzer-beating 3-pointer off the glass to give Toronto a 55-50 advantage, and the Raptors extended it by getting to the foul line 17 times in the third quarter and only missing once. Two John Salmons free throws made it an 82-62 game in favor of the hosts late in the frame.
Notable deaths of 2014 [PHOTOS]