Preheat your oven to 375°F (190°C) and lightly grease a 9x13-inch baking dish.
In a large pan, heat olive oil over medium heat. Add minced garlic and cook until fragrant, about 1 minute.
Pour in marinara sauce, dried basil, and red pepper flakes (if using). Simmer for 5 minutes.
Spread a thin layer of sauce on the bottom of the baking dish.
Arrange half of the ravioli in a single layer over the sauce.
Cover with half of the remaining sauce and sprinkle with half of both cheeses.
Repeat layers with remaining ravioli, sauce, and cheese.
Cover with foil and bake for 30 minutes.
Remove foil and bake for an additional 10-15 minutes until cheese is golden and bubbly.
Let rest for 5-10 minutes before serving. Garnish with fresh basil.