The Knicks declined to match the Rockets' three-year, $25.1 million offer sheet by Tuesday's midnight deadline, allowing the 23-year-old to move on to Houston.
Lin played for the Rockets in the pre-season of the lockout-shortened 2011-12 season before being picked up by the Knicks on waivers.
He scored at least 20 points nine times in a 10-game stretch during February for New York, sparking a late-season playoff push and a fan phenomenon dubbed "Linsanity."
"Extremely excited and honored to be a Houston Rocket again!!" Lin wrote on his Twitter account.
"Welcome to Houston!, We plan to hang on this time. You will love RedNation," Rockets General Manager Daryl Morey Tweeted.
Lin missed the last month of the regular season -- and New York's only playoff series -- after undergoing left knee surgery in April to repair a meniscus tear.
The undrafted Harvard product averaged 14.6 points, 6.2 assists and 3.1 rebounds in 35 games for the Knicks last season.