Preheat and prep: Heat your oven to 375°F (190°C).
Lightly grease a 9x13-inch baking dish with butter or spray.
Cook the pasta: Boil ziti in well-salted water until just shy of al dente (1–2 minutes less than the package). Drain and toss with a splash of olive oil to prevent sticking.
Brown the meat (if using): In a large skillet, heat olive oil over medium. Add onion and cook until soft, about 4 minutes.
Add garlic; cook 30 seconds. Add sausage or ground meat and cook, breaking it up, until browned. Drain excess fat.
Make the sauce: Stir in crushed tomatoes, tomato sauce, tomato paste, oregano, dried basil, sugar (if using), a pinch of red pepper flakes, salt, and pepper.
Simmer 10–15 minutes, stirring occasionally. If using fresh basil, stir in half at the end.
Mix ricotta filling: In a bowl, combine ricotta, 1 cup mozzarella, Parmesan, egg (if using), a pinch of salt and pepper, and a tablespoon of chopped parsley or basil. This creates a creamy, flavorful center.
Combine pasta and sauce: In a large bowl, toss the drained ziti with most of the sauce, reserving about 1 cup to spread on top later.
The pasta should be well coated but not soupy.
Layer it up: Spread half the sauced pasta in the baking dish. Dollop and gently spread the ricotta mixture over the pasta. Add the remaining pasta.
Spoon the reserved sauce evenly over the top.
Add the cheese: Sprinkle the remaining 1 cup mozzarella evenly over the surface. Add an extra dusting of Parmesan if you like a deeper savory crust.
Bake: Cover loosely with foil (tent it so it doesn’t stick to the cheese) and bake for 20 minutes. Remove foil and bake 10–15 minutes more, until the top is melted and lightly browned with bubbly edges.
Rest and serve: Let the baked ziti rest for 10 minutes so it sets and slices cleanly.
Top with fresh basil or parsley. Serve with extra Parmesan and a simple green salad.