Boil the pasta: Bring a large pot of salted water to a rolling boil. Cook spaghetti until just shy of al dente according to package directions. Before draining, reserve 1–1.5 cups of starchy pasta water.
Make the egg mixture: In a medium bowl, whisk together 2 whole eggs, 2 yolks, and the grated Parmesan or Pecorino.
Add a generous pinch of black pepper. Set aside.
Sauté the mushrooms: While the pasta cooks, heat olive oil in a large skillet over medium-high heat. Add mushrooms in an even layer and let them sear undisturbed for 2–3 minutes, then stir and continue cooking until browned and reduced, about 6–8 minutes.
Season with salt.
Add garlic and butter: Reduce heat to medium. Stir in butter and garlic, cooking for 30–60 seconds until fragrant. Turn off the heat.
Combine pasta and mushrooms: Add drained pasta directly to the skillet with the mushrooms.
Toss to coat, adding a splash of reserved pasta water to loosen any browned bits. Let it cool for 30 seconds off heat so the eggs won’t scramble.
Create the sauce: Pour the egg-cheese mixture onto the pasta while tossing constantly. Add reserved pasta water a little at a time until the sauce turns glossy and clings to the noodles.
You’ll likely use about 3/4 cup, but adjust as needed.
Season and finish: Taste and adjust salt. Add more black pepper for that classic carbonara warmth. If using, sprinkle in lemon zest and parsley for brightness.
Serve immediately: Twirl into bowls and top with a bit more cheese and pepper.
Enjoy while hot and silky.