Preheat oven to 375°F (190°C).
Cut the spaghetti squash in half, removing all seeds.
Place facedown into a large baking dish, and pour water in the dish so it comes about halfway up the pan.
Bake for about 30–40 minutes (you want to slightly undercook the spaghetti squash).
Meanwhile, in a food processor, combine 1 cup (25 g) of the basil leaves along with the walnuts, olive oil, 2 cloves of garlic, and salt and pepper to taste. Process until smooth.
When spaghetti squash is done, scrape the insides of the squash with a fork to remove the insides of the squash.
Set aside.
Heat a large skillet over medium heat, and add the butter.
Once melted, add the 1 clove of minced garlic.
Stir in the spaghetti squash, along with the pesto. Gently fold in the tomatoes, fresh basil, and pine nuts (if desired).
Cook until everything is well-incorporated and the spaghetti squash is cooked to your preferred doneness.