Condoms and lube are an effective way to protect yourself from acquiring HIV and many other STIs, like syphilis and gonorrhea. Usually made of thin latex, condoms provide a physical barrier that viruses and bacteria can't pass through.
When used consistently and correctly, condoms are extremely reliable. Make sure you use lots of lube for anal sex – it’s absolutely essential for having a good time!