Heat the oven to 375°F. Bring a large pot of salted water to a boil.
Cook the pasta 2 minutes less than the package directions. Drain.
Meanwhile, heat the oil in a large skillet or saucepan over medium heat. Cook the onion until soft, about 5 minutes. Add the garlic and cook 30 seconds.
Add the crushed tomatoes, Italian seasoning, sugar, red pepper flakes, 1 tsp salt and 1/4 tsp pepper. Simmer 10 to 15 minutes while the pasta cooks.
In a bowl, stir together the ricotta, egg, half the Parmesan, a pinch of salt and pepper.
Toss the drained pasta with about two-thirds of the sauce. Spread half the pasta in a 9x13-inch baking dish. Dollop the ricotta mixture over it and sprinkle with 1 cup mozzarella.
Top with the remaining pasta and sauce, then the rest of the mozzarella and Parmesan.
Cover with foil and bake 20 minutes. Uncover and bake 15 to 20 minutes more, until bubbly and the cheese is lightly browned.
Rest 10 minutes before serving.