The parent company of Arby's and Buffalo Wild Wings is acquiring burger chain Sonic in a deal valued at $2.3 billion, the companies announced Tuesday.

Sonic shareholders will receive $43.50 per share in cash, which is a 19 percent premium to Sonic's Monday close.The company's stock rose more than 18 percent Tuesday, hitting an all-time high of $44.87 per share.

Majority owned by private equity firm Roark, Inspire Brands was formed in February after Arby's acquired Buffalo Wild Wings. Inspire has wanted to build out its portfolio of restaurants. With the addition of Sonic, the company will operate more than 8,000 restaurants and have combined system sales in excess of $12 billion.

Sonic, which has more than 3,500 restaurants and $4.4 billion in system sales, will be operated as its own separate business unit. The deal is set to close by the end of this year.

The acquisition comes as Sonic has struggled against competition from bigger rivals like McDonald's and Burger King. Same-store sales for the chain have fallen for the last two years, but were set to rebound in the fiscal fourth quarter of this year.

The company earlier this month said earnings and same-store sales in the current quarter would outpace expectations. Sonic anticipates a 2.5 percent increase in traffic and a 2.6 percent bump in sales at restaurants open at least 12 months, as additions to its menu resonated with customers.

"Sonic is a highly differentiated brand and is an ideal fit for the Inspire family," Paul Brown, CEO of Inspire Brands, said in a statement.

Sonic is unique in part because it is a drive-in restaurant, but it also has a diverse and quirky menu. The company offers everything from hot dogs and cheese fries to ice cream, limeades and flavored slushes.

Inspire is known for its collection of niche restaurant brands. Sandwich chain Arby's is its alternative to standard burger and chicken chains, serving up nearly a dozen different proteins as it embraces its slogan "We have the meats." Buffalo Wild Wings is a casual dining restaurant and bar that draws in sports fans and families. And Rusty Taco gives Inspire a foot in the Mexican food space.

"In our opinion, the deal underscores that private equity players continue to have an interest in putting money to work in the restaurants sector following an active restaurants M&A environment throughout 2017-2018," said David Tarantino, an analyst at Baird.

In the past two years, Zoes Kitchen agreed to be bought by Cava Group in August, Jack in the Box sold Mexican chain Qdoba to Apollo Global Management in March and Panera Bread was acquired by JAB Holdings in July 2017.

Private equity players tend to like businesses that generate a lot of cash and require little investment. Restaurants often fit that criteria. There also is likely to be room for cost-cutting, which is another thing private equity players look for in an investment. Not mention, restaurants like Sonic are often run, in part, by franchisees. These owners are responsible for the day-to-day operations instead of the company.

Also, there is the potential for an investor to take the company public in the future since the recent round of deals in the industry has resulted in fewer publicly traded restaurants.