Preheat the oven to 375 degrees F. Lightly grease a 9x13-inch baking dish and set aside.
Cook the pasta in a large pot of salted boiling water according to package directions until just al dente. Drain well and set aside.
While the pasta cooks, heat the olive oil in a large skillet over medium heat. Add the diced onion and cook for 4 to 5 minutes, stirring occasionally, until softened. Stir in the minced garlic and cook for 30 seconds until fragrant.
Add the tomato sauce, drained diced tomatoes, Italian seasoning, basil, salt, black pepper, and red pepper flakes if using. Stir to combine and let the sauce simmer for 10 minutes, stirring occasionally, until slightly thickened.
Remove the skillet from the heat. Add the drained pasta, 1 cup of the shredded mozzarella, the cheddar cheese, and half of the Parmesan cheese to the sauce. Stir until everything is evenly coated and combined.
Transfer the pasta mixture to the prepared baking dish and spread it out evenly. Sprinkle the remaining mozzarella and Parmesan cheese evenly over the top.
Bake uncovered for 25 to 30 minutes, or until the cheese is fully melted and the edges are bubbling. For a golden, slightly crispy top, switch the oven to broil for 2 to 3 minutes at the end, watching carefully to prevent burning.
Remove from the oven and let the pasta bake rest for 5 minutes before serving. Garnish with chopped fresh parsley if desired.