New York(CNN Business) Online reviews have replaced going to a store to lie down on a mattress. That's why Mattress Firm, America's largest bed store, has filed for bankruptcy.

The chain said it plans to remain in business, but it filed for Chapter 11 bankruptcy protection to get out of about 700 unfavorable leases. Mattress Firm said it will quickly close 200 underperforming stores and make decisions about whether to close or maintain the other 500 locations in the coming weeks. There are more than 3,300 Mattress Firm stores in the United States.

Mattress Firm plans to exit bankruptcy in about two months. It hopes that the liquidity gained from the bankruptcy allows it to expand into more favorable markets and even open some new stores in existing markets.

"We will continue to provide unmatched value to our customers by offering the best quality beds at prices that fit any budget today, tomorrow and into the future," said CEO Steve Stagner.

Its parent company, Steinhoff International, is dealing with major problems including accounting irregularities forcing its CEO to resign in December 2017.

Like many retailers, the 32-year-old chain has struggled with overexpansion, including its purchase of Sleepy's in 2016 and Mattress Giant in 2012. The company has many stores in close proximity to one another, cannibalizing sales. It's also grappling with increasing competition from online retailers, including Casper and Amazon.

Casper plans to open 200 stores across the United States in the next three years as part of an ambitious growth plan. The four-year-old company wants to gain exposure with shoppers who prefer trying out a mattress at a store first -- and increase impulse buys that can only come from browsing physical locations.

Stores could help Casper stand out in a crowded mattress market. Digital rivals, such as Purple, Leesa, Tuft & Needle, and Yogabed, have cropped up, while legacy retailers have taken a page from Casper, introducing delivery in a box.

Amazon quietly rolled its own in-house brand of foam mattresses that cost a fraction rivals' beds. For example, an AmazonBasics queen mattress costs $229, compared to $600 at Tuft and Needle and nearly $1,000 at Casper.

A search for a similar bed on Mattress Firm's website yields dozens of results, potentially overwhelming customers. That could push them to online rivals, most of which only offer two or three different kinds of mattresses.