Yeast infections

I recently started having sex and now I seem to get yeast infections. I've never had them before. Is there anything I can do to prevent that? My friend told me to pee after sex.