Human Papillomavirus (HPV) infection constitutes a significant global public health challenge despite the widespread implementation of vaccination programs, with infection rates persistently high. Recent studies suggest that lifestyle factors including diet quality (DQ) and physical activity (PA) could play a pivotal role in the mitigation of HPV infections. This investigation explored the influence of DQ, PA, and a healthy lifestyle on the incidence of HPV infection in adult women. Data from 5,308 women aged 20-59 from the National Health and Nutrition Examination Survey (NHANES) 2007-2016. DQ and PA were measured using the Healthy Eating Index (HEI-2015) and the Global Physical Activity Questionnaire (GPAQ), respectively, creating four lifestyle groups based on how well they matched dietary and activity guidelines. The associations between key factors and HPV infection were explored using multivariate logistic regression, trend tests, and interaction tests. Fully adjusted multivariable logistic regression models revealed an inverse association between the risk of HPV infection and higher levels of PA (OR = 0.914; 95% CI: 0.854-0.979) as well as DQ (OR = 0.993; 95% CI: 0.989-0.998). Individuals in the highest tertile of DQ displayed a reduced risk of HPV infection relative to those in the lowest tertile (OR = 0.846; 95% CI: 0.726-0.986). Belonging to the third quintile of PA was linked to a lower risk of HPV infection than the lowest quintile (OR = 0.823; 95% CI: 0.681-0.995). Subgroups adhering to a healthy DQ were linked to a lower risk of HPV infection irrespective of PA meeting guideline recommendations. Our findings underscore the importance of a healthy diet in conjunction with appropriate PA in preventing HPV infection, offering new insights for public health policies and interventions.