Investors should buy Merck shares because profits from its cancer treatments will top expectations in the coming years, according to Morgan Stanley, which upgraded the pharmaceutical company to overweight from equal weight.

"We expect Merck to return to accelerating earnings growth in 2018 after six years of flat earnings driven by Keytruda growth as Merck builds on its leadership position in immuno-oncology," analyst David Risinger wrote in a note to clients Thursday. "Our long term estimates are well above consensus."