Cook the penne pasta according to the package instructions until it reaches an al dente texture. Drain well and set aside.
In a large skillet over medium heat, warm the olive oil. Add the chopped onion and sauté until it becomes translucent, about 5 minutes.
Add the minced garlic, Italian seasoning, and red pepper flakes (if desired) to the skillet. Continue cooking for another 1-2 minutes until fragrant and the garlic is lightly golden.
In a spacious mixing bowl, combine the cooked penne, the sautéed onion and garlic mixture, ricotta cheese, 1/2 cup of mozzarella, 1/2 cup of Parmesan cheese, and chopped basil. Season generously with salt and pepper to enhance the flavors.
Pour the marinara sauce over the pasta mixture. Gently stir everything together until all the ingredients are well incorporated.
Transfer the creamy pasta mixture to a greased 9x13 inch baking dish, spreading it evenly. Top with the remaining mozzarella and Parmesan cheese for a deliciously cheesy crust.
Cover the baking dish with aluminum foil and place it in the preheated oven. Bake for 25 minutes.
After 25 minutes, carefully remove the foil and continue baking for an additional 15-20 minutes, or until the cheese on top is melted, golden, and bubbling.
Once baked, allow the dish to cool for a few minutes before serving to let the flavors settle.
Notes
Serve in individual bowls, garnished with fresh basil and a sprinkle of Parmesan cheese.