01 - Preheat the oven to 400°F.
02 - In a baking dish, combine cherry tomatoes, garlic, and red onion if using. Drizzle with olive oil and season with salt, black pepper, and red pepper flakes. Toss to coat evenly.
03 - Place the block of feta cheese in the center of the baking dish, nestling it among the tomatoes. Drizzle additional olive oil over the cheese.
04 - Bake for 30 minutes until tomatoes burst and release their juices, and the feta becomes golden and soft.
05 - While baking, cook pasta in a large pot of salted boiling water according to package directions until al dente. Reserve 1/2 cup of pasta cooking water before draining.
06 - Remove from oven. Gently mash feta and tomatoes with a fork, mixing them into a smooth, creamy sauce.
07 - Add cooked pasta to the baking dish, tossing to coat evenly. Add reserved pasta water if sauce is too thick for desired consistency.
08 - Stir in fresh basil leaves just before serving to preserve their vibrant color and aroma.
09 - Serve immediately, garnished with additional basil leaves and a drizzle of olive oil if desired.