Add olive oil, peeled and cut in half garlic cloves, basil leaves (and stems), and red pepper flakes to a large pot. Heat over low heat until basil is wilted but not crispy. Take out the basil and put in a medium bowl. Continue cooking until garlic is lightly golden. Transfer the oil with garlic to the bowl with basil. Leave to cool slightly.
Add butter to the pot. When it's hot and bubbling, add peeled and cut in half onion. Cook until onion and butter are lightly browned.
Add tomatoes and a small pinch of salt. Cover the pot with a lid and cook over low heat for 20-25 minutes. If using whole tomatoes and not crushed tomatoes, mash them with a potato masher.
Meanwhile, add the olive oil with red pepper flakes, garlic, basil leaves (I'm discarding the stems), and a small piece of onion from the pot to a food processor and mix at low speed until smooth (don't mix at high speed or the olive oil can become bitter). Add this to the pot with tomato sauce.
While the sauce is cooking, cook the pasta al dente - it should have a bite to it. Don't overcook it! You should slightly undercook it and it will finish cooking while you're tossing it with the tomato sauce. Reserve some pasta cooking water.
When the sauce is done cooking discard the remaining onion. Season your tomato sauce with salt, pepper, and sugar. Toss with the cooked pasta and a small amount of pasta cooking water.
Serve generously sprinkled with parmesan cheese.
Enjoy!