01 - Set oven to 375°F and allow to reach temperature.
02 - Fill a large pot with salted water and bring to a boil. Cook ziti until al dente following package instructions. Drain and reserve.
03 - Warm olive oil in a large skillet over medium heat. Add chopped onion; cook for 3–4 minutes until softened. Stir in garlic, oregano, basil, and optional red pepper flakes; cook 1 minute.
04 - Stir in crushed tomatoes, salt, black pepper, and sugar. Simmer uncovered for 10 minutes, stirring occasionally.
05 - In a mixing bowl, blend ricotta, Parmesan, and egg until a smooth consistency forms.
06 - Add drained pasta to skillet and gently fold until evenly coated with sauce.
07 - Spread half the sauced pasta in a 9x13-inch baking dish. Dot with half the ricotta mixture and sprinkle with half the mozzarella.
08 - Add remaining pasta and ricotta mixture, then top with remaining mozzarella.
09 - Transfer dish to oven and bake uncovered for 20–25 minutes until cheese is melted and golden brown.
10 - Let stand for 5 minutes before garnishing with chopped parsley and serving.