Preheat the oven to 400 degrees F.
Put a garlic clove underneath the flat side of a chef's knife. Carefully smack it with the heel of your hand to smash the garlic, and then peel off the skins. Repeat for all the garlic.
Put the cherry tomatoes, onions and garlic into a 13-inch by 9-inch baking pan.
Pour the olive oil into the pan and season with red pepper flakes, salt and pepper. Stir the tomatoes, onions and garlic, so they are coated in the oil. Arrange the tomatoes and onions, so they fit snuggly in the pan, mostly in a single layer.
Bake the tomatoes until they have split and are wrinkled and very juicy, about 45-55 minutes.
Give the tomatoes 10-15 minutes to cool.
Carefully transfer everything from the pan to a blender to puree it to your desired consistency.
Depending on how thick you want the sauce, simmer it in a large saucepan over low to medium heat, stirring frequently, for 10-12 minutes.