Preheat your oven to 350°F (175°C). Lightly grease a 9x13-inch baking dish and set aside.
Bring a large pot of salted water to a boil. Cook the spaghetti until just al dente, about 8 minutes. Drain and return to the pot.
In a medium bowl, whisk together the cream cheese, eggs, and milk until smooth.
Stir in half of the cheddar, Parmesan, chopped onion, garlic powder, salt, and pepper.
Pour the creamy mixture over the drained spaghetti. Toss gently to coat every strand with the luscious sauce.
Transfer the coated pasta to the prepared baking dish. Sprinkle the remaining cheddar cheese evenly on top.
Bake for 35–40 minutes, until the cheese is bubbly and golden brown around the edges.
Remove from the oven and let rest for 5 minutes before serving. Garnish with fresh parsley if desired.