Heat oven and prep pan: Heat your oven to 350°F and line a 12-cup muffin tin with paper liners. This gives the oven time to come to temperature while you mix the batter.
Mix the dry ingredients: Whisk the flour, baking soda, baking powder, salt, and pumpkin pie spice together in a large bowl until evenly combined. Set this bowl aside.
Whisk the wet ingredients: In a separate bowl, whisk the eggs, pumpkin puree, oil, granulated sugar, brown sugar, milk, and vanilla until smooth and slightly glossy, about 1 minute.
Combine wet and dry: Pour the wet mixture into the dry ingredients and fold gently with a spatula until just combined. Stop as soon as the flour streaks disappear; a few small lumps are fine.
Fold in walnuts: If using, fold in the chopped walnuts with a few gentle strokes, distributing them evenly without overmixing the batter.
Fill the muffin cups: Divide the batter evenly among the 12 muffin cups, filling each about three-quarters full for a rounded top.
Bake until set: Bake for 18 to 22 minutes, until the tops spring back when pressed lightly and look matte rather than wet.
Test for doneness: Insert a toothpick into the center of a muffin; it should come out clean or with a few moist crumbs, not wet batter.
Cool before removing: Let the muffins cool in the pan for 5 minutes, then transfer them to a wire rack to cool completely before storing.
Store for later: Keep muffins in a covered container at room temperature for up to 2 days, or freeze for longer storage.