FRANKFURT (Reuters) - GlaxoSmithKline bolstered its cancer drug development pipeline on Tuesday, agreeing to pay up to 3.7 billion euros ($4.2 billion) to Germany’s Merck KGaA for the rights to a next-generation immunotherapy.

A logo of drugs and chemicals group Merck KGaA is pictured in Darmstadt, Germany January 28, 2016. REUTERS/Ralph Orlowski/File Photo

Merck will receive an upfront payment of 300 million euros for the drug - known as M7824, or bintrafusp alfa - and is eligible for potential payments of up to 500 million euros depending on development milestones in lung cancer, the two companies said in statements on Tuesday.

Merck could also get up to a further 2.9 billion euros, depending on commercial milestones, for a total deal value of as much as 3.7 billion euros.

Merck will book any future U.S. sales from the product, while GSK will account for sales from other parts of the world.

GSK in December moved to bolster its cancer medicines cabinet with the $5.1 billion purchase of Tesaro.

Later that month, it unveiled plans to separate its prescription drugs and vaccines business from its over-the-counter products unit under a joint venture deal with Pfizer’s consumer health division.

“For GSK, this alliance is a further step in the company’s priority to strengthen its pharmaceuticals pipeline,” it said.

The M7824 drug, a fusion protein that triggers two immune responses to cancer cells, is being tested on 10 tumour types and was recently shown to delay the progression of a certain type of lung cancer for at least 9.5 months in half of the trial participants.

Merck has already started a mid-stage phase II trial in non-small cell lung cancer, comparing M7824 directly with U.S. rival Merck & Co’s Keytruda, currently seen as the most promising cancer immunotherapy on the market with $7.2 billion in 2018 sales.

Keytruda is part of a class of immunotherapies known as checkpoint inhibitors, which are expected to generate well over $20 billion in combined annual revenues over the next few years.

Merck KGaA, which has no ownership ties with Merck & Co, is competing in that class with a drug called Bavencio, jointly developed with Pfizer, but analysts expect the drug to play only a minor commercial role.

For M7824, Merck combined Bavencio’s mode of action with another immune response booster known as TGF-beta-inhibtion.

“This combination in a single molecule is unique. We don’t know of any other at this time,” said Belen Garijo, the head of Merck’s healthcare division.

Deutsche Bank analysts said the trial against Keytruda was the main study to watch.

“We expect investors to see the deal as a bold move to build GSK’s late stage oncology pipeline, bringing in an asset with very large potential but with substantial risk,” they wrote in a note.

Merck’s shares traded 2.1 percent higher at 1420 GMT, while GSK was up 1.7 percent, both outperforming the 0.7 percent gain in the STOXX Europe 600 Health Care index.

($1 = 0.8758 euros)