Krispy Kreme is acquiring a majority stake in Insomnia Cookies, the sweet-treats brands announced on Friday.

The deal will pull the cookie-delivery company into JAB Holdings' café-and-coffee empire, which includes Krispy Kreme, Panera, and Pret A Manger.

JAB acquired Krispy Kreme for roughly $1.35 billion in 2016.

Krispy Kreme is getting into the cookie business.

On Friday, the brand announced that it would acquire a majority stake in Insomnia Cookies. The terms of the deal were not announced, though a source told CNBC that the then-unannounced deal would value Insomnia Cookies at less than $500 million.

"At Krispy Kreme, we have an 81-year heritage of creating the most awesome doughnut experience imaginable, and today we are delighted to add Insomnia Cookies, a rapidly growing business with an innovative delivery experience and exceptional product that is beloved by consumers," Mike Tattersfield, Krispy Kreme's CEO, said in a statement.

The deal represents another step in building a café-and-coffee empire by JAB Holdings, the Luxembourg-based investment arm of the wealthy Reimann family.

JAB acquired Krispy Kreme for roughly $1.35 billion in 2016. Since then, JAB has acquired brands including Panera, Au Bon Pain, and Pret A Manger.

Insomnia Cookies was founded in 2003 by Seth Berkowitz, then a student at the University of Pennsylvania. It has since grown into a chain with 135 US locations, nearly doubling in size in just the past three years after finding a loyal following among college students with late-night cravings for sweet treats.

"Mike and I share the same ambition for our brands: To be the best at what we do and delight consumers with the highest-quality sweet-treat experiences," Berkowitz said in a statement. "My team and I are confident that this shared vision makes Krispy Kreme the ideal partner to support Insomnia through our next phase of growth."

The transaction is set to close in the fourth quarter of this year. Berkowitz is set to continue to serve as the CEO of Insomnia Cookies, which will act as an independent, standalone company.