4 tablespoons extra-virgin olive oil, divided, plus more for drizzling
2 tablespoons chopped sage
4 ounces pancetta, finely diced
1 large onion, finely chopped
3 garlic cloves, thinly sliced
½ teaspoon crushed red pepper flakes
1 small butternut squash, peeled, halved, seeded, cut into ½-inch cubes (about 6 cups)
3 cups low-sodium chicken stock or broth
1 pound penne or rigatoni
3 ounces Parmesan, finely grated (about 1½ cups), divided, plus more for serving
3 ounces mozzarella, grated
1 cup basil leaves, torn
Freshly ground black pepper
Preheat oven to 350°. Toast walnuts on a rimmed baking sheet, tossing halfway through, until golden brown, 6–8 minutes. Let cool, then finely chop and transfer to a medium bowl. Stir in sage and 2 Tbsp. oil; set aside.
Cook pancetta in a medium pot until crispy. Remove from pot and set aside. If there is any fat left in pot, leave about a tablespoon.
Heat remaining 2 Tbsp. oil in the same pot used to cook pancetta over medium-high. Cook onion, stirring occasionally, until golden brown and softened, 8–10 minutes. Add garlic and red pepper and cook, stirring, until fragrant and garlic is softened, about 1 minute. Add squash and toss to combine. Add stock and bring to a boil. Reduce heat to medium-low and gently simmer until squash is tender, 12–15 minutes. Let cool slightly.
Meanwhile, cook pasta in a large pot of boiling salted water, stirring occasionally, until very al dente, about 3 minutes less than package directions. Drain, then rinse with cold water.
Transfer squash mixture to a blender or use an immersion blender. Blend until mostly smooth. It can be a bit chunky if you like. Add 1 cup Parmesan and purée until smooth; season with salt.
Pour ½ cup squash purée into a 13x9" baking dish and spread to edges. Scatter pasta over sauce, toss pancetta over pasta then pour remaining sauce over. Mix in Parmesan and mozzarella. Leave a bit of cheese to top off pasta dish at the end. Cover with foil and bake 15 minutes. Uncover and increase oven temperature to 425°. Continue to bake until top is darkened in spots and sauce is bubbling, 10–15 minutes.
Sprinkle basil on pasta dish, season with salt and pepper, and toss to combine. Spoon walnut mixture over pasta. Top with more Parmesan and mozzarella.