Kimberly-Clark Corp. agreed to buy Kenvue Inc. for roughly $40 billion, snapping up the embattled Tylenol maker’s storied brands in a gamble that would vault the Kleenex producer into consumer health’s top tier.

Kimberly-Clark agreed to pay a total consideration of $21.01 per Kenvue share, a 46% premium to the Tylenol maker’s closing price on Friday. The deal values Kenvue at $48.7 billion on an enterprise basis, the companies said.