NEW YORK -- James Harden returned from a one-game absence because of a foot injury and poured in 36 points to lead the Houston Rockets to a 109-106 win over the New York Knicks on Thursday night.
Jeremy Lin scored 21 points in his second game back to Madison Square Garden since his "Linsanity" days two seasons ago with the Knicks.
The win was the 16th in 17 games for the Rockets against the Knicks, who have dropped three straight at home.
Carmelo Anthony scored a season-high 45 points for the Knicks (3-5) and Andrea Bargnani had 24.
Lin scored nine points in the fourth quarter for his third solid game in a row. He scored 31 points against Toronto on Nov. 11 and 34 at Philadelphia on Wednesday.
Harden scored 12 points in the fourth quarter.
The Rockets made seven of their free throws in the final 2:18 to preserve the win, including Harden's two from the line with 2.9 seconds left that provided the final margin.
Bargnani's 3-pointer with six minutes to play tied the score at 91, but the Rockets pulled away with an 11-2 run to take a 102-93 lead with 3:59 left. Harden scored seven points during the spurt.
Houston center Dwight Howard was held to seven points, his lowest output of the season. He did, however, contribute 15 rebounds and four blocked shots to help the Rockets (5-5) get to .500.
Howard had 41 points and 39 rebounds in his last two games.
The score was knotted at 75 with 11:26 before Houston used an 8-0 run to move ahead 83-75 with 10:03 to play. Lin scored five points during the burst.
Bargnani's second 3-pointer of the game closed the Houston lead to 74-72 late in the third quarter.
Iman Shumpert gave the Knicks a 61-59 edge with a jumper with 7:54 left in the third quarter. Then the Rockets went on a 13-4 run to move ahead 72-65 with 2:59 left. Harden led the spurt with seven points on a 3-pointer and two driving layups.
Anthony dropped in 26 first-half points, his high in one half this season. He was 11 of 15 from the floor.
Anthony nailed two 3-pointers and Bargnani drained one trey and a mid-range jumper, all late in the quarter, to trim Houston's lead to 53-50 at the half.
The Rockets built a 38-29 lead with 7:52 left in the second quarter with Howard and Harden on the bench.
The Knicks committed seven fouls in the first quarter and Houston took advantage, making 11 of its 12 free throws to help it to a 28-23 lead. Lin was 6 of 6 from the stripe.
NOTES: Rockets F Greg Smith limped off the court with 1:46 left in the first quarter after landing awkwardly fighting for a rebound with F Carmelo Anthony. ... Houston G James Harden returned to the starting lineup after missing one game with a bruised left foot. He's fifth in the league in scoring, averaging 24.9 ppg. ... Rockets C Dwight Howard leads the league in rebounds (14.9 rpg). ... Anthony is averaging 34.8 points on 47.9 percent shooting in his last seven games against the Rockets. ... F Terrence Jones started just his second game of the season for Houston. ... In three straight home losses before Thursday night, the Knicks have been outscored by an average of 15 points while allowing 110.3 points per game.