There can be many causes for the semen turning yellow. Some are harmless and some may be worrisome.

In the former case, sulfur XXXXXXX diet, presence of urine in the semen, sexual encounter after a long break, etc., can all cause a yellowish tinge in the semen. The more worrisome causes would be infections like infection, prostatitis, etc.

Now the important step here is to find the cause and treat it. A few test such as routine urine analysis and semen analysis can help us to rule out infections. Your physician can help in streamlining the test. Antibiotics may be required if any infection is found. Hence I encourage you to consult you physician.

Meanwhile, drink plenty of water. Also urinate before any sexual encounter.

Hope I have answered your query. If you have any more queries, please get back to me.