Heat the oven to 400°F (200°C).
Arrange the tomatoes cut-side up on a large rimmed sheet pan with the onion and garlic. Drizzle with the olive oil and sprinkle with the salt, pepper and pepper flakes.
Roast for 45–60 minutes, until the tomatoes have collapsed and are browned at the edges.
Scrape everything, including the juices, into a pot or blender. Add the basil and blend to the texture you like, either chunky with an immersion blender or smooth in a blender (vent the lid when blending hot liquids).
Taste and add more salt or a splash of vinegar if the tomatoes need brightening. Simmer for 5–10 minutes to thicken if needed.