Houston Rockets' Jeremy Lin (7) drives against Portland Trail Blazers' Thomas Robinson (41) and Mo Williams (25) during the first half of game six of an NBA basketball first-round playoff series game in Portland, Ore., Friday May 2, 2014. (AP Photo/Greg Wahl-Stephens)

The Houston Rockets traded Jeremy Lin to the Los Angeles Lakers to create salary-cap space to sign Chris Bosh only to have Bosh decide to stay with the Miami Heat, league sources told Yahoo Sports.

The Rockets sent a 2015 first-round pick and other draft considerations to the Lakers to unload the final year of Lin's $14 million expiring contract that includes a salary cap hit of $8.3 million based on the deal's structure.

The Lakers will send cash and the rights to an overseas player to the Rockets, sources said.

Moving Lin to Los Angeles cleared most of the salary cap-space necessary to sign Bosh to a four-year, $80 million-plus contract. The Rockets thought they were close to securing Bosh only to have him accept a five-year, $118 million deal to stay with the Heat.

The Rockets have to decide whether to match Chandler Parsons' three-year, $46 million offer sheet with the Dallas Mavericks once Bosh has committed, sources told Yahoo Sports. They also have been in contact in recent days with the agents for free-agent forwards Luol Deng and Trevor Ariza, sources said.

The fact Lin has only one year left on his deal appealed to the Lakers, who want to keep flexibility for future free-agent classes. The Lakers also reached agreement on deals to re-sign free-agent forward Jordan Hill and free-agent guard Nick Young.

Paul Gasol turned down a two-year contract offer from the Lakers that would have paid him about $10 million annually and is likely moving to another team, sources told Yahoo Sports.

More NBA coverage: