The surest way to eliminate risk for genital human papillomaviruses (HPV) infection is to refrain from any genital contact with another individual.
For those who choose to be sexually active, a long-term, mutually monogamous relationship with an uninfected partner is the strategy most likely to prevent genital HPV infection. However, it is difficult to determine whether a partner who has been sexually active in the past is currently infected.
It is not known how much protection condoms provide against HPV infection, because areas not covered by a condom can be infected by the virus. Although the effect of condoms in preventing HPV infection is unknown, condom use has been associated with a lower rate of cervical cancer, an HPV-associated disease.
The U.S. Food and Drug Administration (FDA) have approved two vaccines to prevent HPV infections: Gardasil® and Cervarix®. Both vaccines are highly effective in preventing persistent infections with HPV types 16 and 18, two high-risk HPVs that cause most (70 percent) cervical cancers. Gardasil also prevents infection with HPV types 6 and 11, which cause virtually all (90 percent) genital warts. In addition, there is some initial evidence that Cervarix provides partial protection against a few other HPV types that can cause cancer, but further evaluation is required before the magnitude and impact of this effect is understood.
This answer is based on source information from the National Cancer Institute.