Preheat the oven to 400°F (200°C).
Wash the outside of the spaghetti squash, then cut it in half lengthwise. Trim the ends if desired.
Use a spoon to remove the seeds and stringy bits from each half.
Rub the cut interior of the squash with 2 tablespoons olive oil and sprinkle with 2 teaspoons Italian herb blend.
Place the squash halves cut-side down on a baking sheet lightly coated with non-stick spray or oil.
Roast for about 40–50 minutes, beginning to check at 40 minutes; the squash is done when the flesh is still slightly firm but pulls apart into strands easily.
Let the squash cool a few minutes until manageable, then scrape the flesh with a fork to create spaghetti-like strands and transfer them to a mixing bowl; discard the skins.
Gently stir in 3 tablespoons basil pesto and 1 cup of the coarsely grated Parmesan until evenly combined. Season with salt and freshly ground black pepper to taste.
Pour the squash mixture into a gratin dish or baking pan, sprinkle the remaining 1/4 cup Parmesan evenly over the top, and bake for 20–30 minutes until bubbling and lightly browned.
Remove from oven and serve hot.