01 - Preheat oven to 375°F. Grease a 9x13 inch baking dish with cooking spray or butter.
02 - Cook ziti pasta in a large pot of salted boiling water until just al dente, approximately 2 minutes less than package instructions. Drain and set aside.
03 - Heat olive oil in a large skillet over medium heat. Add chopped onion and cook until softened, about 3 to 4 minutes. Stir in minced garlic and cook for 1 minute more.
04 - Add ground beef to the skillet and cook, breaking it up with a spoon, until browned and cooked through. Drain excess fat if necessary.
05 - Stir in crushed tomatoes, tomato sauce, tomato paste, oregano, basil, red pepper flakes if using, salt, and pepper. Simmer for 10 minutes, stirring occasionally.
06 - In a large bowl, combine cooked ziti, half of the meat sauce, ricotta cheese, and half of the mozzarella and Parmesan cheeses. Mix gently to combine.
07 - Spread half of the remaining meat sauce in the prepared baking dish. Add the ziti mixture on top. Spread the rest of the sauce evenly over the pasta. Sprinkle with remaining mozzarella and Parmesan cheeses.
08 - Cover with aluminum foil and bake for 20 minutes.
09 - Remove foil and bake for another 10 to 15 minutes, until cheese is golden and bubbly.
10 - Let rest for 10 minutes before serving. Garnish with fresh basil if desired.