$3.25 billion cash payment and royalties on future sales.
The drug developers currently split earnings from Tysabri, but Elan said the new deal will give it capital for investing and growing its business.
Under the new terms, Elan will receive a royalty of 12 percent of global Tysabri sales for the first 12 months. It will then receive a royalty of 18 percent on up to $2 billion of global sales and 25 percent on more than $2 billion.
The boards of both companies have approved the deal, which is expected to close by the end of the second quarter.
Biogen Idec Inc., based in Weston, Mass., expects the deal to add between 20 cents and 30 cents to its 2013 earnings per share.
Tysabri is a drug taken intravenously once a month to treat a form of multiple sclerosis that cycles between stages of relapse and remission.
Elan and Biogen have been partners in marketing Tysabri since 2000. Elan marketed Tysabri in the U.S. after buying its supply from Biogen Idec. Biogen sold the drug in other markets and paid royalties to Elan.
Tysabri was considered a breakthrough because it stopped MS relapses 70 percent of the time while removing lingering traces of symptoms. However, it was briefly yanked the market in 2005 when some patients with a common background virus developed brain infections.
In a rare move, the Food and Drug Administration allowed Tysabri back on the market in 2006 with strict protocols. Patients are tested for the virus, must come in for the IV treatment every four weeks and must check in with their neurologist every three months.
The companies said in the fall about 71,000 patients were being treated with Tysabri in 2012. That was up 13 percent from a year ago.
Biogen shares rose $3.62, or 2.3 percent, to $160.98 in trading Wednesday after rising as high as $167.35 earlier in the session. That was an all-time high, according to FactSet.