At 400°F, it takes about 40-45 minutes to cook spaghetti squash in a rimmed pan until it's fork tender.