Sonic's "this is how you sonic" slogan may be due for a name change. "This is how you profit" might be more fitting.

The drive-in burger joint has managed to fatten up the pockets of its investors in recent months while many fast food companies struggle.

Sonic isn't doing it by offering healthy alternatives like salads or veggie burgers. Rather, it's doubling down on indulgence, but keeping it affordable to many Americans.

"I think Sonic understands their core customer more than the big guys do," proclaimed Will Slabaugh, an analyst with Stephens Inc. "You're typically going out to indulge. You're watching that waistline a little less and your wallet a little bit more."

Related: White Castle now serving veggie sliders

Investors seem more than satisfied. Sonic's (SONC) stock surged about 10% Wednesday after the company reported its best quarterly results in a decade. It's now up over 30% in the past three months.

Competitors McDonalds (MCD) and Wendy's (WEN) are pretty far behind. In fact, McDonald's just brought back its "lovin' it" marketing campaign in an effort to put some feel good back into its business.

So what's Sonic's secret sauce?

Menu and marketing: Sonic is coming off a string of strong product offerings and has been smart about backing them up with savvy promotional marketing, explained Slabaugh.

He mentioned the success of its boneless chicken wings and all beef hot dog promotions. Their wide variety of milkshake flavors also remain popular.

Their "Two Guys," television commercials, which feature two men talking about and eating Sonic sitting in a car, has also been a hit, claimed Slabaugh.

"Some of them are a little annoying, but you always remember where they came from," he said.

Related: Another crisis for McDonald's Japan after plastic found in McNuggets

Knowing the customer: According to Robert Derrington, an analyst at Wunderlich Securities, Sonic has found a nice niche somewhere in the middle between run-of-the-mill fast food and what he calls "fast casual" restaurants.

"It's resonating with consumers trying to feed a family of four who don't want to pay for traditional sit downs, but also don't want to eat traditional fast food that's questionable in its quality," he said.

And unlike McDonald's, Sonic has never gone international. In fact, the majority of its stores are located in the South. The U.S. focus allows it to better concentrate on its target demographic, claimed Slabaugh.

Going forward: Wednesday's stellar results aside, the company does face some challenges moving forward. Rising commodity prices, especially for beef, are a headwind, noted Derrington, though he's hopeful that rising sales will offset those costs.

The stock currently trades at around 26 times this year's earnings, which is more than Wendy's price-to-earnings ratio of 23. Most analysts think cheaper gas will be a boon for Sonic.

Derrington believes the stock could continue to run.

"I don't expect the company's business to slow of any material nature," he said.