Preheat the oven to 375°F (190°C). Lightly grease a 9x13-inch baking dish with non-stick spray and set aside.
In a large skillet over medium heat, cook the ground Italian sausage and diced onion, breaking up the meat, until the sausage is no longer pink and the onion is softened, about 6–8 minutes.
Add the minced garlic to the skillet and cook, stirring, for 1–2 minutes until fragrant.
Stir in the pasta sauce, dried Italian seasoning, dried basil, and red pepper flakes; bring to a simmer and remove from heat.
Spread 1 1/2 cups of the sauce mixture evenly over the bottom of the prepared baking dish.
Arrange half of the thawed ravioli in a single layer over the sauce. Spoon 1 1/2 cups of sauce over the ravioli, then sprinkle with 1 1/2 cups shredded mozzarella and 2 tablespoons (1/8 cup) grated Parmesan.
Top with the remaining ravioli, spread the remaining sauce over them, and finish with the remaining 1 1/2 cups mozzarella and remaining Parmesan.
Cover the dish with foil and bake for 30 minutes. Remove the foil and bake an additional 25 minutes, or until heated through and the cheese is bubbly and lightly golden.
Let the casserole rest for 5–10 minutes before slicing and serving.