Adding Sleepy's will give Mattress Firm 80 distribution centers in 48 states.

(Bloomberg)—Mattress Firm Holding Corp. 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 operating 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.

Mattress Firm, No. 492 in the Internet Retailer 2015 Top 500 Guide, 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% in the trailing 12 months. Mattress Firm had an Internet Retailer-estimated $27.9 million in online sales in 2014, according to data.

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.