Melt butter in medium saucepan over medium heat. Add onion and cook until softened, about 5 minutes. Add garlic and cook until fragrant, about 30 seconds.
Add ketchup, molasses, brown sugar, vinegar, mustard, chili powder, black pepper, and cayenne pepper and stir to combine. Bring to a boil, then reduce heat to low and simmer until slightly thickened, about 30 minutes, stirring frequently.
Transfer sauce to a blender and blend until smooth. Let cool to room temperature, transfer to a jar and store in refrigerator for up to a month.