To prevent anal cancer, reduce your risk by avoiding getting HPV, which is passed on through sexual contact. It's important to remember that you can have HPV and not have genital warts or any other symptoms. To reduce your risk of HPV infection use condoms when having sex, limit the number of sexual partners you have, don't have anal sex and if you smoke, try to stop.
Attribution: BUPA