Houston survived the highest-scoring performance in the NBA this season, a 45-point show from Carmelo Anthony.
Anthony scored the last of his points from the foul line with five seconds to go, bringing the Knicks within one, but after Harden was fouled he converted both his tries to account for the final score.
J.R. Smith missed a chance to tie the game at the buzzer.
Harden scored 36 points after missing Wednesday's game against Philadelphia with a sore foot. He made 16-of-18 from the line. Chandler Parsons added 22 points and Jeremy Lin had 21.
Anthony converted 17-of-30 from the field and had 10 rebounds as well.
Houston made 38 free throws to 22 for the Knicks, who failed in their bid to win back-to-back games for the first time this season.