Mattress Firm Holding Corp. (Nasdaq: MFRM) agreed to buy rival Sleepy’s for $780 million, uniting the two largest specialty mattress retailers in the U.S.

As part of the deal, Mattress Firm is assuming $30 million in liabilities, according to a statement on Monday. Sleepy’s Chief Operation Officer Adam Blank will join Mattress Firm’s management and contribute $10 million in equity in exchange for the acquiring company’s stock. The rest of the purchase will be handled in cash.

There have been some other deals in sleep products recently. Select Comfort Corp. (Nasdaq: SCSS) is picking up Bam Lambs Inc. and Sentinel Capital Partners added Hollander Sleep Products.

Mattress Firm agreed to the takeover after sluggish demand and discounting weighed on its results, dragging down its stock over the past year. The shares are down 31 percent in the trailing 12 months.

Adding Sleepy’s will give the Houston-based company a total of almost 3,500 retail stores and 80 distribution centers in 48 states. Mattress Firm also expects to get $40 million in cost savings annually by the third year after the deal closes. The company is counting on Sleepy’s contributing earnings per share in the low-single digits in the first year, rising to double digits in the third year.

The transaction is slated to be completed in the first half of fiscal 2016, assuming it passes antitrust hurdles.

Gibson Dunn & Crutcher LLP is representing Sleepy's.