Heat oven to 350°F. Grease a 9×5-inch loaf pan and line with a parchment sling.
Whisk flour, baking soda, baking powder, salt, cinnamon, nutmeg, ginger, and cloves in a bowl.
Whisk squash puree, both sugars, oil, eggs, vanilla, and milk in a large bowl until smooth.
Add dry ingredients to wet. Stir gently until no dry streaks remain; do not overmix.
Fold in walnuts, if using.
Scrape batter into the pan. Smooth the top and tap the pan to release bubbles.
Bake 55–65 minutes, until a tester comes out clean. Tent with foil if browning early.
Cool 15 minutes in the pan. Lift out, cool completely on a rack, then slice.