Bring a large pot of lightly salted water to a boil. Cook spaghetti in the boiling water, stirring occasionally, until tender yet firm to the bite, about 12 minutes. Drain and immediately return spaghetti to pot.
While spaghetti is cooking, place shrimp in a large pan over medium heat. Add 1/2 the olive oil; season with salt and pepper. Cook and stir until shrimp is mostly opaque, about 5 minutes. Add shrimp to the pot of cooked and drained pasta; cover and keep warm.
Heat the remaining olive oil in the same pan. Cook and stir onion until translucent, about 5 minutes. Add garlic; cook until fragrant, about 1 minute more. Add milk and half-and-half; cook until heated through, about 3 minutes.
Pour 1/4 cup of the milk mixture into a bowl; add eggs and stir until warmed through. Pour into the pot with the shrimp and pasta and add the milk mixture. Top with Parmesan cheese and parsley.