Rachel Edwards has a pretty sweet job. As the head brewer of Oozlefinch Beers & Blending in Fort Monroe, Va., she thinks like a pastry chef, writing beer recipes that use toasted coconut, marshmallows, fruit purées and “more vanilla beans than I can even tell you,” Ms. Edwards said.

She checks ingredient combinations with “The Flavor Bible,” a culinary reference book, then makes beers simulating sweets like Key lime pie, coffee cake and even banana pancakes topped with syrup. “There are so many ingredients that you can utilize to create what I call ‘a dish in a glass,’” she said.

Most of these beers are sweetened with lactose, the sugar derived from milk, and are in such demand that the brewery’s distributors buy entire batches one to two months before Oozlefinch brews them. “People are excited to drink their carbs,” Ms. Edwards said. “They’re looking for intense flavors.”

In recent decades, the American beer industry has pushed beer to attention-grabbing extremes, brewing bitter I.P.A.s and funky wild ales. But the more than 8,000 breweries nationwide need to attract more customers by looking beyond “hard-core beer drinkers,” said Greg Engert, the beer director and a managing partner of the Neighborhood Restaurant Group, which operates beer bars across Washington, D.C., and the Grand Delancey in New York City.

So, hundreds of breweries are aiming for mainstream appeal with so-called pastry beers inspired by beloved desserts, snacks and candies. You don’t have to be a beer geek to understand or appreciate “a barrel-aged stout that’s mirroring a lava cake that they may have had at Applebee’s,” said Alex Kidd, the founder of the website DontDrinkBeer, who claims to have coined the phrase “pastry stout.”

Nostalgia is also essential to the allure. In both its flavors and on its labels, Orono Brewing in Orono, Maine, pays homage to Hostess Fruit Pies, a cherished treat, with its pastry sour ales. Abe Furth, a founder and the head of sales and marketing, said that as a boy in rural Maine, he would “get a Hostess Fruit Pie for doing chores.” The beers offer an emotional connection to where customers grew up.

Convenience stores can transcend regional preferences, offering a culinary reference point for hungry, road-weary travelers. In 2019, the Mid-Atlantic chain Sheetz started partnering with breweries to create beers incorporating its foods and candy, such as watermelon gummy rings and blueberry muffins.

Last fall, Sheetz worked with Wicked Weed Brewing, of North Carolina, on Project Happy Hole-idayz, brewed with Sheetz doughnut holes. “You feel like you’re eating something while you’re having a drink at the same time,” said Travis Sheetz, the president and chief operating officer.

Decadent Ales, in Mamaroneck, N.Y., opened in 2016 with a catchy slogan — “Eat your beer” — and a focus on beers like the tiramisù imperial stout and Blueberry Frosted Pastry, an I.P.A. reminiscent of a Pop-Tart.

Mimicking food can be complicated. “It’s more than just, ‘Let’s just throw in marshmallows and hope it tastes like marshmallows,’” said Paul Pignataro, an owner and brewer. To make the Double Toasted Marshmallow I.P.A., he brews an oat-rich beer for fluffiness, then adds scratch-made marshmallows. Liquid smoke lends toastiness, and vanilla beans and various sugars provide subdued aromatics and sweetness.

Quality ingredients are a major part of pastry beer production. “If you want to buy 300 or 400 pounds of toasted coconut, you can’t go to a retailer like Target,” said José García, the senior director of supply chain for Nuts.com.

In the summer of 2018, the sales department noticed that breweries were ordering thousands of pounds of specialty products. The next year, the site added a special brewery sales portal that highlights commonly bought products like cacao nibs, peanut butter powder and graham cracker crumbs. Last year, Nuts.com sold to more than 800 brewery customers.

“The thicker, sweeter and more dessert-driven they are, the more they sell,” said Jared Welch, a founder and the production manager of Southern Grist Brewing Company, a Nashville brewery whose barrel-aged beers sell out in less than a minute after they go online.

Every fermented beverage is fair game for pastry-ification. Evil Twin Brewing NYC, in Ridgewood, Queens, invented the Evil Water line of surprisingly crisp “pastry seltzers” in flavors such as vanilla ice cream, pecan pie and mixed berries with marshmallows.

The pastry seltzers were initially mocked, but are now a must-have for the brewery’s customers. “Our taproom manager told me they never see an online order for beer without at least one four-pack of seltzer,” said Jeppe Jarnit-Bjergso, the founder and an owner, who trademarked the term pastry seltzer.

As breweries pursue concentrated flavors, pastry beers can run the risk of being overly sweet. After a recent tasting of four hazelnut-flavored pastry beers, Mr. Kidd of the DontDrinkBeer website consumed so much sugar that he couldn’t fall asleep. “My glycemic index was so high,” he said.

For Keigan Knee, a founder and director of product development of Modist Brewing in Minneapolis, a pastry beer must pass the pie test: “If you order a slice of pie and it’s so ungodly sweet that you can’t eat the full slice, then it’s too sweet,” Mr. Knee said.

At their best, pastry beers deliver whimsy and delight, two words not typically associated with the past year. They transport drinkers to a time when a great dessert could make your day.

Ms. Edwards of Oozlefinch is now exploring a series of punch-inspired beers called Punch Yourself, including a version based on rainbow sherbet punch, a childhood favorite. “Having an alcoholic version as an adult sounds pretty amazing to me,” she said.