MINNEAPOLIS — Yao Ming attempted to sign Knicks point guard sensation Jeremy Lin to play for his Shanghai Sharks during the NBA lockout, but was unsuccessful, two league sources told The Post.

Lin, who helped the Knicks beat the Timberwolves last night, 100-98, has had a close bond with Yao since playing in Yao’s charity basketball games in Taiwan and Beijing in August 2010.

Yao, who retired as an NBA player in July because of chronic foot injuries, owns the Sharks, for whom he once played. Yao also has started his own wine label and has embarked in politics, recently named to a powerful political advisory committee.

Following his historic 38-point outburst against the Lakers on Friday night, Lin revealed he is close to Yao and communicates often with the 7-foot-6 Chinese basketball legend, mostly by text message. Yao lives in Shanghai.

“Yao cares for [Lin’s] well-being,’’ one person familiar with the relationship said. “He’s that kind of guy.’’

Lin didn’t follow the lead of other NBA players who left for China during the lockout — Wilson Chandler, Kenyon Martin and J.R. Smith, to name a few. Had Lin not been claimed by the Knicks on Dec. 26 after being waived by the Rockets, there was a chance he could have wound up with Yao in Shanghai.

Lin’s mother, Shirley, was raised in Taiwan and Yao invited Lin’s family to his charity event soon after Lin graduated from Harvard and before his rookie NBA season with the Warriors. Sources said the fans “knew who Jeremy was.’’

Following the rout of the Lakers, Lin, the first Chinese-American to play in the NBA, said, “I actually talk to Yao after every game. He’s taken me out to eat when I’ve seen him. He’s obviously a role model, big brother and mentor to me. We keep in touch all the time.’’

Yao, 31, and Lin, 23, would see each other socially whenever Golden State played Houston. Earlier this week, Lin said had the Knicks waived him before his contract became guaranteed Friday, he would have looked overseas, though the Chinese Basketball Association is now in the playoffs and he would have had to consider Europe.

“I wasn’t considering that just yet,” Lin said, “but I figure if I get waived before the [Feb. 10] deadline and there’s nothing left, you know, maybe I do need to go overseas, but God works in mysterious and miraculous ways.”