Preheat Oven and Cook Pasta: Preheat oven to 375°F (190°C). Cook ziti pasta according to package directions, until al dente. Drain and set aside.
Make the Sauce: Heat olive oil in a large skillet over medium heat. Add onion and cook until softened, about 5 minutes. Add garlic and cook for 1 minute until fragrant. Stir in crushed tomatoes, tomato sauce, oregano, basil, red pepper flakes (if using), salt, and pepper. Bring to a simmer and cook for 15 minutes, stirring occasionally.
Prepare the Cheese Mixture: In a large bowl, combine ricotta cheese, Parmesan cheese, and eggs. Mix well.
Assemble the Ziti: In a large baking dish (9x13 inch), spread a thin layer of sauce on the bottom. Add half of the cooked ziti, then half of the ricotta cheese mixture, and half of the shredded mozzarella. Pour half of the remaining sauce over the mozzarella. Repeat layers: add the rest of ziti, then the remaining ricotta cheese mixture, and spread the rest of the sauce over the top layer of mozzarella.
Bake: Cover the baking dish with foil and bake for 25 minutes. Remove foil and bake for another 15-20 minutes, or until the cheese is melted, bubbly, and lightly golden brown.
Let Rest: Let the baked ziti rest for 10 minutes before serving.