Preheat your oven to 350°F and lightly grease a 8x8 -inch baking dish with non-stick spray.
In a skillet, melt butter over medium to medium-high heat and cook the onions, stirring occasionally, until they're soft and translucent.
In your dish, combine the baked beans, ketchup, mustard, molasses, and brown sugar, and stir until well blended.
Add the sautéed onions to the mixture and mix everything together.
Arrange the raw bacon strips on top in a single layer. Place the dish in the oven, uncovered, and bake for 1.5 to 1 hour and 45 minutes. Keep an eye on the beans — they’re done when the top turns golden brown and slightly caramelized.
If you're doubling the recipe, simply extend the baking time to 2 to 3 hours for the perfect result.