The Rockets trailed by six heading into the fourth quarter before outscoring the Grizzlies 34-20 during the final 12 minutes.
Houston, coming off its unexpected road win over San Antonio on Christmas Day, reached 20 victories for the season.
Lin scored 14 of his 18 points in the closing period. Harden finished with 27, making just two field goals but hitting 22-of-25 from the foul line. The 22 free throws were the most the Grizzlies have given up in the history of the franchise.
Terrence Jones added 20 points for the Rockets and Chandler Parsons had 15. Dwight Howard found himself in early foul trouble, did not play during the fourth quarter and wound up with only two points.
Houston made 33 foul shots overall to just 11 for Memphis.
The Grizzlies, who had won their previous two games, were led by 23 points from Zach Randolph. He made only 8-of-20 from the field.
Swim Week Miami Beach 2014 [PHOTOS]