Bristol-Myers Squibb is buying cancer drugmaker Celgene in a cash and stock deal valued at $74 billion, the companies announced Thursday.

Under the agreement, Celgene shareholders will receive one Bristol-Myers Squibb share and $50 in cash for each share held, or $102.43 per share, a premium of 53.7 percent to Celgene's Wednesday close.

Shares of Celgene surged 28 percent in midmorning trading, to near $85 per share, while shares of Bristol-Myers Squibb fell 11 percent.

"Together with Celgene, we are creating an innovative biopharma leader, with leading franchises and a deep and broad pipeline that will drive sustainable growth and deliver new options for patients across a range of serious diseases," Bristol-Myers Squibb Chairman and CEO Giovanni Caforio said in a press release.

Wall Street analysts see the deal as a big win for Celgene. The company was set to lose patent protection by 2022 for Revlimid, its top-selling multiple myeloma drug, concerning investors. The stock has fallen more than 37 percent over the past year.

Early last year, Celgene agreed to buy the rest of Juno Therapeutics it didn't already own for about $9 billion in cash to gain access to Juno's pipeline of cancer drugs.

The company has been working on an experimental new gene therapy called CAR T-cell therapy — taking a patient's own immune cells, called T cells, genetically manipulating them to attack specific proteins on cancer, and infusing them back into the patient. CAR T-cell therapy is a highly competitive and potentially lucrative area of biotechnology.

BMO Capital Markets analyst Alex Arfaei said Thursday the proposed acquisition seems expensive; however, it probably addresses a major strategic priority for New York-based Bristol, which has had several R&D setbacks in the past few years.

New Jersey-based Celgene has also "been under significant pressure given concerns about Revlimid," he said in a note to clients.

Buying Celgene gives Bristol more cancer drugs at a time when its immuno-oncology portfolio struggles to keep up with rival Merck's. But there's skepticism about the deal's price tag.

The boards of directors of both companies approved the deal, which is expected to close in the third quarter. The combined company will have nine products with more than $1 billion in annual sales and significant potential for growth in oncology, immunology and inflammation and cardiovascular disease. The deal is expected to realize $2.5 billion in synergies by 2022.

The two companies have been talking since Sept. 2018, when Bristol approached Celgene.

Bristol-Myers Squibb shareholders will own approximately 69 percent of the company, and Celgene shareholders are expected to own 31 percent.

Caforio will continue to serve as chairman and CEO of the company. Two members from Celgene's board will be added to the board of Bristol-Myers Squibb.

—CNBC's David Faber and Angelica Lavito contributed to this report.