Cook pasta in salted water according to package instructions until just al dente, then drain (do not overcook as the pasta will continue to cook in the oven).
In a deep pan or Dutch oven, over medium-high heat, cook ground beef and onion, breaking up the beef with a spatula, until beef is fully cooked through and onions are softened (5-7 minutes).
Spread a ladle of meat sauce into the bottom of a 9×13 casserole dish. Add chopped basil and spoon in ricotta into the remaining sauce Add cooked pasta and stir just until noodles are coated (you want to keep that ricotta texture)
Transfer half of the pasta to the casserole dish. Top with 1/2 of the shredded mozzarella and 1/2 of the grated parmesan. Add the remaining pasta and top with the remaining mozzarella and parmesan.
Clear the edges of the pan so the cheese doesn’t burn onto the dish. Bake at 350°F for 25 minutes. Broil for 1-2 minutes to brown the cheese. Let cool for 5 minutes, then garnish with basil if desired and serve.