Because there is no effective vaccine and no cure for HIV, the only way to protect oneself is prevention.
People should either abstain from indulging in penetrative sex or use latex condoms, during oral, anal, or vaginal sex. Only condoms made of latex should be used, and whenever necessary only water-based lubricants should be used. People who are allergic to latex can use polyurethane condoms.
The risk of HIV transmission from a pregnant woman to her baby gets significantly reduced if she takes AZT during pregnancy, labor and delivery, and her baby takes it for the first six weeks of life. Nevirapine is also found to be useful. But, one should seek expert medical assistance in such situations.
Having a sexually transmitted disease (STD) can increase the chance of getting infected with HIV mainly through sexual contact. So, it is necessary to treat STD as soon as one suspects infection.