How do I prevent coconut milk from separating in Thai curry?
Even though it isn't really milk (in the dairy sense), coconut milk still naturally separates into a thick cream and thinner liquid like regular milk. As such, when working with coconut milk you should still follow the same procedures you would to make a milk-based cream sauce.

The number one rule when making any creamy sauce is: DON'T LET IT BOIL! Boiling will guarantee that your creamy sauce (including sauces made with coconut milk) will break in some form or fashion. At most, you should cook these at a bare simmer.

Other than that, there are some techniques you can use to keep your curry smooth.

You could use an emulsifier like honey (common in vinaigrettes, where it is used to make sure the oil and vinegar don't separate), added toward the end of cooking.

You could also use a thickening agent, like a cornstarch slurry or a quick roux. Curry paste is also a thickening agent. As a general rule of thumb, when making Thai-style curry I usually cook my vegetables in a little more oil than I think they need, then add the curry paste and sauté that until it has absorbed the oil (along with any dry spices). It will act as a roux for the coconut milk and make sure there are no lumps in the final curry.

Lastly, cooking the curry uncovered at a simmer, stirring occasionally, will thicken it up nicely and help all the ingredients stay together.