To keep white sauce from separating you should maintain consistent and low heat and add a thickener such as cornstarch or flour before you add the milk.
Avoid overheating or adding the ingredients to the white sauce too quickly as it can disrupt the emulsion.
White sauce is best cooked at a consistent and low heat.
Overheating of the white sauce can cause the proteins in the milk to curdle and lead to separation.
When adding ingredients to the white sauce such as cheese or butter you should add them gradually to the heated white sauce to avoid any sudden temperature fluctuations which can cause separation.
Roux is a good and classic thickening agent that can be used in the white sauce to help keep the white sauce from separating.
Cook the flour and butter together until it's slightly golden and then add the liquid like the milk and also while whisking it constantly.
You can also dissolve some cornstarch or arrowroot powder in a little cold water to create a slurry and then add it to the sauce while whisking.
You can also create a flour slurry which is similar to cornstarch slurry by mixing some flour and cold water together and then add it to the white sauce.
Low fat dairy products used in the white sauce can also cause it to separate as a result of the lower fat.
Whole fat dairy products such as whole fat milk is best when making white sauce to keep it from separating.
Mustard is also a good emulsifier to help prevent the white sauce from separating.