Celgene agreed on Monday to buy the rest of Juno Therapeutics it doesn't already own for about $9 billion in cash to gain access to Juno's pipeline of CAR-T cancer drugs.

Celgene owns 9.7 percent in Juno and will offer $87 per share for the rest of the company. Shares of Juno Therapeutics were up 27 percent on the news, to just below the offering price.

The clock was ticking for Celgene, Mike Bailey, director of research at FBB Capital Partners, told CNBC last week.

Celgene loses patent protection by 2022 for Revlimid, its top-selling multiple myeloma drug that brought in about 60 percent of fiscal third quarter revenue of nearly $3.3 billion.

Once the patent runs out, Celgene could feel pressure from generics within a few years, Bailey said.

Celgene is working with Seattle-based Juno on an experimental new gene therapy designed to treat people with relapsed or refractory aggressive B-cell non-Hodgkin lymphoma.

The treatment is a type of so-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.