Drugmaker AbbVie said on Tuesday it would buy Botox-maker Allergan for about $63 billion, grabbing control of by far the biggest name in medical aesthetics to help reduce its reliance on blockbuster arthritis treatment Humira.

The two companies have been in talks for the last six to seven weeks, sources told CNBC's David Faber. The talks were initiated by AbbVie Chief Executive Richard Gonzalez, sources said.

AbbVie has been under pressure to diversify its portfolio as Humira, the world's best-selling drug, is already in competition with cheaper versions in Europe and faces expiration of its patents in 2023 in the United States, its most important market.

Humira, which brought in revenue of about $20 billion last year, reported the first fall in quarterly sales in years in the January-March period.

AbbVie's Gonzalez, 65, will helm the combined company and remain chairman and chief executive through 2023, the companies said. The deal will effectively re-domicile Allergan as a U.S. company.

Allergan Chief Executive Officer Brent Saunders, who put together the current version of his company through a series of deals to roll up several pharmaceutical firms in 2014, will join AbbVie's board upon completion of the deal.

Saunders built his reputation as a dealmaker, but Allergan has struggled since Pfizer walked away from a $160 billion deal in 2016. Allergan's shares have lost around half their value since then.

He has been under pressure over the last year to break up or sell the company, with activist investor David Tepper running a campaign to urge Allergan to hire an independent chairman.