Bring a large pot of salted water to a boil and cook the ziti according to package directions until al dente. Drain and set aside.
Heat the olive oil in a large skillet over medium heat. Add the diced onion and cook for 3 minutes until softened.
Add the ground beef to the skillet. Cook, breaking it up with a spoon, until browned and no longer pink. Stir in the minced garlic, salt, and pepper and cook for 1 minute more.
Pour the marinara sauce into the skillet with the beef. Simmer for 5 minutes, then remove from heat.
In a large bowl, combine the cooked ziti with the beef sauce. Gently fold in the ricotta cheese so it stays in small clumps.
Transfer the mixture to a greased 9x13 baking dish. Sprinkle the mozzarella and Parmesan evenly over the top.
Bake at 375°F for 20 minutes until the cheese is melted and lightly browned. Remove from the oven and scatter the chopped fresh basil over the surface before serving.