Preheat the oven to 400°F and set the oven rack in the middle position. Grease a 9 x 13-inch baking dish and set aside.
Bring a large pot of salted water to a boil. Cook the rigatoni according to package instructions for very al dente (it will continue cooking in the oven). Drain and set aside.
Meanwhile, heat olive oil in a large skillet or Dutch oven over medium-high heat. Add the sausage and onion. Cook until the sausage is browned and no longer pink, about 5-7 minutes, breaking it into crumbles as it cooks.
Add the garlic and cook for 30 seconds, until fragrant.
Stir in both jars of marinara sauce, basil, red pepper flakes, and salt and pepper to taste. Simmer over medium-low heat for 5-7 minutes.
Add the cooked pasta to the sauce and toss to combine.
Spread half of the pasta mixture in the bottom of the prepared baking dish. Top with 1 cup of mozzarella and ¼ cup of Parmesan.
Add the remaining pasta mixture. Sprinkle with the remaining 1 cup of mozzarella and ¼ cup of Parmesan.
Bake uncovered until the casserole is hot and bubbly and the cheese is golden in spots, about 20 minutes.
Let rest 5-10 minutes before serving. Garnish with fresh herbs if desired.