Preheat your oven to 350°F (175°C).
Cook the spaghetti according to package instructions until al dente. Drain and set aside.
In a large skillet over medium heat, brown the ground beef with the chopped onion and minced garlic until the meat is fully cooked. Drain any excess fat.
Stir in the marinara sauce, Italian seasoning, salt, and black pepper. Simmer for about 5 minutes.
In a large mixing bowl, combine the cooked spaghetti and the meat sauce mixture. Mix well to ensure the spaghetti is evenly coated.
In a separate bowl, mix the ricotta cheese with half of the mozzarella cheese and half of the Parmesan cheese.
In a greased 9x13-inch baking dish, layer half of the spaghetti mixture, followed by the ricotta mixture, and then the remaining spaghetti mixture on top.
Sprinkle the remaining mozzarella and Parmesan cheeses over the top.
Cover the dish with aluminum foil and bake for 25 minutes. Remove the foil and bake for an additional 15 minutes, or until the cheese is bubbly and golden.
Let it cool for 5-10 minutes before serving. Garnish with fresh parsley if desired.