01 - Preheat oven to 375°F. Grease a 9x13-inch baking dish with cooking spray or butter.
02 - Bring a large pot of salted water to a boil. Cook ziti according to package instructions until just al dente. Drain well and set aside.
03 - Heat olive oil in a large skillet over medium heat. Add onion and cook for 3 minutes until softened. Add garlic and cook for 1 minute more until fragrant.
04 - Add ground beef to the skillet. Cook, breaking up the meat with a wooden spoon, until fully browned. Drain excess fat if needed.
05 - Stir in marinara sauce, dried basil, dried oregano, salt, black pepper, and crushed red pepper flakes if using. Simmer for 5 minutes to blend flavors.
06 - In a large bowl, combine cooked ziti, meat sauce, half the mozzarella cheese, and all the ricotta cheese. Mix gently until evenly coated.
07 - Transfer half the pasta mixture to the prepared baking dish. Sprinkle with half the remaining mozzarella and half the Parmesan. Layer the rest of the pasta on top, then finish with remaining mozzarella and Parmesan.
08 - Cover baking dish tightly with aluminum foil. Bake for 20 minutes to heat through.
09 - Remove foil and bake for another 10 minutes, or until cheese is golden brown and bubbly around the edges.
10 - Allow baked ziti to rest for 10 minutes before serving. This helps the cheese set and makes serving easier.