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 scrape out the seeds and fibrous strands from each half.
Rub the cut surfaces of the squash with 2 tablespoons olive oil and sprinkle evenly with the Italian herb blend.
Place the squash cut-side up on a baking sheet sprayed with non-stick spray and roast for 40–55 minutes, checking after 40 minutes, until the flesh is tender and can be scraped into spaghetti-like strands.
Let the squash cool a few minutes until safe to handle, then use a fork to scrape the strands into a mixing bowl and discard the skins.
Gently stir in 3 tablespoons pesto and 1 cup of the grated Parmesan until combined; season with salt and freshly ground black pepper to taste.
Transfer the squash mixture to a gratin or baking dish, sprinkle the remaining 1/4 cup Parmesan evenly over the top, and bake 20–30 minutes until the mixture is bubbling and the cheese is melted and starting to brown.
Remove from the oven and serve hot.