Preheat your oven to 375°F (190°C).
Cook the ziti pasta according to package instructions until al dente. Drain and set aside.
In a large skillet, heat the olive oil over medium heat. Add the Italian sausage, breaking it apart with a spoon, and cook until browned, about 5-7 minutes.
Add the diced onion and minced garlic to the skillet. Sauté until the onion is translucent, about 3-4 minutes.
Stir in the crushed tomatoes, oregano, basil, red pepper flakes, salt, and pepper. Simmer for 10 minutes to allow the flavors to meld.
In a separate bowl, mix together the ricotta cheese, egg, and a pinch of salt and pepper until smooth.
In a large mixing bowl, combine the cooked ziti, sausage mixture, and ricotta mixture. Stir until well combined.
Transfer half of the ziti mixture to a greased 9x13 inch baking dish. Sprinkle half of the mozzarella cheese on top. Add the remaining ziti mixture and top with the remaining mozzarella and Parmesan cheese.
Cover the baking dish with aluminum foil and bake for 25 minutes. Remove the foil and bake for an additional 15 minutes, or until the cheese is bubbly and golden.
Let it cool for 5-10 minutes before serving. Garnish with fresh basil if desired.