This vegetarian baked spaghetti is the ultimate meatless comfort food — a hearty, cheesy pasta casserole layered with sautéed zucchini, mushrooms, bell peppers, and onions in a rich garlic tomato sauce, then topped with creamy ricotta, melty mozzarella, and freshly grated Parmesan. It bakes up golden and bubbling, feeds a crowd, and is just as satisfying the next day. Perfect for weeknight dinners, meal prep, or feeding picky eaters who swear they'll miss the meat.
Preheat your oven to 375°F (190°C). Lightly grease a 9x13 inch baking dish with olive oil or nonstick spray and set aside.
Bring a large pot of salted water to a boil, then cook the spaghetti for 2 minutes less than the package directions. Drain (do not rinse) and set aside.
Heat olive oil in a large skillet over medium heat. Cook the onion for 3 to 4 minutes until soft, then add the garlic and stir for 60 seconds. Add the zucchini, bell pepper, and mushrooms; cook for 6 to 7 minutes until tender and any liquid has evaporated. Season with Italian seasoning, red pepper flakes, salt, and pepper.
Stir the marinara sauce and drained diced tomatoes into the skillet with the vegetables. Simmer over medium-low heat for 5 minutes, then remove from heat and taste for seasoning.
In a medium bowl, stir together the ricotta, egg, 1/4 cup Parmesan, and a pinch of salt and pepper until smooth and well combined.
Add the drained spaghetti to the skillet with the tomato vegetable sauce and toss thoroughly until every strand is coated and the vegetables are evenly distributed.
Spread half the sauced pasta in the prepared baking dish, then layer with all of the ricotta mixture and 1 cup of mozzarella. Top with the remaining pasta, then scatter the remaining 1 cup of mozzarella and 1/4 cup of Parmesan evenly over the top.
Cover the dish tightly with aluminum foil and bake at 375°F for 20 minutes.
Remove the foil and bake for another 15 minutes, until the cheese is melted and golden. For a deeper golden top, broil for 2 to 3 minutes, watching closely.
Let the casserole rest for 5 to 10 minutes before serving to help it set. Scatter torn fresh basil over the top and serve directly from the dish.
Notes
Always undercook the pasta by 2 minutes before baking — it finishes cooking in the oven and this prevents a mushy texture.
Use whole milk ricotta, not part-skim. Full-fat ricotta stays creamy after baking; part-skim can turn grainy and release extra moisture.
Grate your own Parmesan from a block for best melt and flavor. Pre-grated contains anti-caking agents that prevent smooth melting.
Make sure mushroom liquid fully evaporates before adding the sauce — this prevents a watery casserole.
Make ahead: assemble the full casserole, cover tightly, and refrigerate up to 24 hours. Add 10 extra minutes to the covered bake time when going straight from fridge to oven.
Storage: refrigerate leftovers in an airtight container for up to 4 days. Freeze (tightly wrapped) for up to 3 months; thaw overnight in the fridge before reheating.
Reheat in a 350°F oven covered with foil for 15 to 20 minutes, or microwave individual portions with a splash of marinara on top to prevent drying out.
Vegan swap: replace ricotta with cashew cream or seasoned firm tofu, use a flax egg (1 tbsp ground flaxseed + 3 tbsp water), and swap in vegan mozzarella shreds.
Vegetable variations: spinach, eggplant, artichoke hearts, broccoli, or cherry tomatoes all work well — just cook down any high-moisture additions before adding the sauce.
White sauce version: substitute the marinara with a creamy béchamel or alfredo sauce for a completely different but equally delicious bake.