Shire won over Baxalta, the maker of treatments for rare blood conditions, cancers and immune system disorders, after six months of talks.
It is the first major healthcare deal of 2016 and suggests high-profile takeovers are likely to continue.
Health firms struck $673bn in deals in 2015, according to Thomson Reuters.
Announcing the deal, Shire chief executive Flemming Ornskov said the merged group would generate $20bn in revenue by 2020.
"Together we will have the number one platform in rare diseases with a strong foundation for future growth," Mr Ornskov told reporters.
Shire prizes Baxalta's pipeline of new treatments, which it believes will contribute to an extra $5bn in revenue in the next four years.
The firms also estimate $500m in cost savings, partly from Baxalta benefiting from Shire's lower corporation tax in Dublin.
Shire shares dropped 6.7% to 3,990p.
An initial bid of $30bn, made up entirely of Shire stock, was rejected by Baxalta in August for "significantly undervaluing" the company.
But Shire won over Baxalta's shareholders in part with a sweetener of $18 cash per Baxalta share.
The deal is now due to go through by mid-2016, Shire said.
UK pharmaceutical firm Shire has struck a $32bn (£22bn) deal for US rival Baxalta to create one of the biggest treatment providers for rare diseases.