Preheat and prep. Heat your oven to 375°F (190°C).
Lightly oil a 9x13-inch baking dish or a similar casserole pan.
Cook the pasta. Bring a large pot of salted water to a boil. Cook rigatoni until 1–2 minutes shy of al dente according to package directions. Drain and set aside.
Brown the sausage. In a large skillet, warm olive oil over medium heat.
Add sausage, breaking it up with a spoon, and cook until well browned and cooked through, about 6–8 minutes. Spoon off excess fat if needed.
Sauté aromatics. Add onion to the skillet and cook until softened, about 3–4 minutes. Stir in garlic and cook 30 seconds, just until fragrant.
Build the sauce. Pour in marinara.
Add oregano and crushed red pepper flakes if using. Simmer 5 minutes. Taste and season with salt and black pepper.
Mix the ricotta. In a bowl, stir ricotta with a pinch of salt, a grind of pepper, and 2 tablespoons of Parmesan for extra flavor.
If you like it looser, add a splash of pasta water or milk.
Toss it together. In a large bowl, combine the drained rigatoni with most of the sausage sauce. Reserve about 1 cup of sauce for layering.
Layer the casserole. Spread a thin layer of the reserved sauce in the baking dish. Add half the pasta mixture, dot with half the ricotta, and sprinkle with one-third of the mozzarella and a little Parmesan.
Repeat with remaining pasta and ricotta. Top with the last of the sauce, then the remaining mozzarella and Parmesan.
Bake. Cover loosely with foil (tent it so it doesn’t stick to the cheese) and bake for 20 minutes. Remove foil and bake another 10–15 minutes, until the top is bubbly and lightly golden.
Rest and garnish. Let the casserole rest for 10 minutes so it sets and slices cleanly.
Sprinkle with chopped basil or parsley before serving.