01 - Preheat oven to 375°F. Lightly grease a 9x13-inch baking dish.
02 - Bring a large pot of salted water to a boil. Cook ziti until al dente according to package directions. Drain and set aside.
03 - Heat olive oil in a large skillet over medium heat. Add chopped onion and sauté for 3 to 4 minutes until softened. Add garlic and cook for 1 minute until fragrant.
04 - Add ground beef to skillet. Break up with a spoon and cook until browned and cooked through, about 5 to 6 minutes. Drain excess fat if necessary.
05 - Stir in marinara sauce, Italian seasoning, crushed red pepper flakes if using, salt, and black pepper. Simmer for 5 minutes to blend flavors. Remove from heat.
06 - In a medium bowl, combine ricotta, 1 cup mozzarella, ¼ cup Parmesan, and the egg until smooth.
07 - Spread half of the cooked ziti in the baking dish. Top with half the meat sauce, then dollop half the ricotta mixture over the sauce. Repeat with remaining pasta, sauce, and ricotta mixture.
08 - Sprinkle the remaining 1 cup mozzarella and ¼ cup Parmesan evenly on top.
09 - Cover with foil and bake for 25 minutes.
10 - Remove foil and bake an additional 10 to 15 minutes until cheese is melted, bubbly, and slightly golden.
11 - Allow to rest for 10 minutes before serving. Garnish with fresh basil or parsley if desired.