Preheat your oven to 375°F (190°C).
Cook the ziti pasta according to package instructions until al dente. Drain and set aside.
Heat olive oil in a large skillet over medium heat. Sauté diced onion for 2–3 minutes, then add garlic and cook for another minute.
Add the ground beef to the skillet, breaking it up with a spoon, and cook until browned. Drain excess fat.
Stir in the marinara sauce and season with salt, pepper, and basil. Simmer for 5–10 minutes.
In a large bowl, mix ricotta cheese with the egg and half of the mozzarella cheese.
Add cooked pasta to the meat sauce and stir to combine.
In a 9x13-inch baking dish, spread half the pasta mixture, then layer with ricotta mixture, and top with the remaining pasta.
Sprinkle the remaining mozzarella and Parmesan cheese on top.
Cover with foil and bake for 20 minutes. Remove foil and bake an additional 10 minutes until bubbly and golden.
Garnish with fresh parsley if desired. Let rest for 5 minutes before serving.