"Sometimes I eat ribs nekked, but if company's coming, I usually put on pants."Meathead
When it comes to storing sauces, we have two concerns: Safety and flavor. We don't want any microbes setting up housekeeping in our sauce, and we want the flavors to remain bright and fresh.
Commercial barbecue sauces usually have preservatives so they can keep in the fridge for many months, even a year or more. Homemade sauces, at least my recipes, have no added preservatives, per se.
The good news is that vinegar, salt, sugars, some spices, and other common ingredients all have antimicrobial and preservative properties, so they tend to help sauce safe from microbes and fresh tasting for weeks, even months. As long as you keep your sauce refrigerated, you should have little risk. Just make sure that when you are done making the sauce you put it in a very clean glass bottle with a tight fitting lid. I use Ball canning jars and lids and run them through my dishwasher, but jelly jars and bottles from other condiments work fine as long as they have tight lids. Just clean them well.
Also, never dip a brush into sauce and then brush meat, contaminating it with meat juices and microbes, and then put it back into the jar. Pour what you need into a coffee cup and if there is leftover after cooking, toss it.
Oxygen and heat are the natural enemies of freshness, and we all have seen ketchup turn black under the cap from oxidation. So don't let bottles of sauce sit out on the dining table for long, and certainly not on the shelf next to the grill. Again, pour what you need and chuck any unused sauce out.
If a sauce recipe calls for cooking onions, garlic, or spices in oil, then expect shelf life to shorten a bit. Oil can go rancid with time, especially animal fats such as bacon fat and butter. If you want to keep it a long time use a vegetable oil rather than butter.
Storebought herbs and spices are often steam treated or irradiated to kill microbes, but fresh herbs and spices can be contaminated just by airflow or birds or critters, so they pose a small risk. That's why most of my sauces call for dried herbs and spices.
That said, sauces from my recipes keep well for months in the fridge.
Many sauces contain sugar and can burn quickly, so the secret is to hold off on the sauce until the last 10 to 15 minutes. Click here for more on saucing strategies.