Preheat the oven to 400°F (200°C).
Wash the outside of the spaghetti squash, then cut it in half lengthwise. Optional: trim the ends so the halves sit flat.
Use a spoon to scrape out the seeds and stringy bits from each half.
Rub the cut surfaces with 2 Tbsp olive oil and sprinkle evenly with the Italian herb blend.
Place the squash halves cut-side down on a baking sheet sprayed with nonstick spray.
Roast the squash in the oven, checking after about 40 minutes; continue roasting until the flesh is tender and can be scraped into strands with a fork (large squash may take ~50 minutes).
Let the squash cool slightly, then use a fork to scrape the flesh into spaghetti-like strands into a mixing bowl and discard the skins.
Gently stir in 3 Tbsp pesto and 1 cup of the grated Parmesan until combined; season with salt and freshly ground black pepper to taste.
Transfer the squash and cheese mixture to a gratin or baking dish, sprinkle the remaining 1/4 cup Parmesan over the top, and bake 20–30 minutes until the mixture is bubbling and the cheese is melted and beginning to brown.
Remove from the oven and serve hot.