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 until the sausage is browned and onion is softened, about 6–8 minutes. Drain excess fat if needed.
Add the minced garlic to the skillet and cook 1–2 minutes until fragrant. Stir in the pasta sauce, dried Italian seasoning, dried basil, and red pepper flakes; bring to a simmer.
Spoon 1 1/2 cups of the sauce mixture evenly over the bottom of the prepared baking dish.
Arrange half of the ravioli in a single layer over the sauce. Spread 1 1/2 cups of sauce over the ravioli, then sprinkle with 1 1/2 cups shredded mozzarella and about 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 the remaining Parmesan.
Cover the dish tightly 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 5 minutes before slicing and serving.