To prevent curdling, cook the sauce over low heat and avoid boiling it. Gradually add the cheese while stirring constantly until it's fully melted.