Keep the penis and the glans clean at all times. When washing your genitals, pull back the foreskin (if uncircumcised) and clean the head of the penis and the ‘neck’ with mild soap and water so that all deposits of smegma is washed away.
Use condom when having sex with a not so familiar person. This can prevent you from acquiring STI and also balanitis causing microbes.