BackgroundObesity and infertility are associated with poorer sexual function. We have previously shown that a lifestyle intervention in women with obesity and infertility reduced weight and improved cardiometabolic health and quality of life, which may positively affect sexual function. We now report on sexual function 5 years after randomization.Methods and findingsIn total 577 women, between 18–39 years of age, with infertility and a BMI ≥29 kg/m2 were randomized to a six-month lifestyle intervention targeting physical activity, diet and behavior modification or prompt infertility care as usual. Intercourse frequency and sexual function were assessed with the McCoy Female Sexuality Questionnaire (MFSQ), 5.4±0.8 years after randomization. 550 women could be approached for the follow-up study, of whom 84 women in the intervention and 93 in the control group completed the MFSQ. Results were adjusted for duration of infertility, polycystic ovary syndrome and whether women were attempting to conceive. The intervention group more often reported having had intercourse in the past 4 weeks compared to the control group (aOR: 2.3 95% CI 0.96 to 5.72). Among women reporting intercourse in the past 4 weeks, the intervention group (n = 75) had intercourse more frequently (6.6±5.8 vs. 4.9±4.0 times; 95% CI 0.10 to 3.40) and had higher scores for vaginal lubrication (16.5±3.0 vs. 15.4±3.5; 95% CI 0.15 to 2.32) and total ‘sexual function’ score (96.5±14.2 vs. 91.4±12.8; 95% CI 0.84 to 9.35) compared to the control group (n = 72). Sexual interest, satisfaction, orgasm and sex partner scores did not differ statistically between the groups. The intervention effect on sexual function was for 21% mediated by the change in moderate to vigorous physical activity.ConclusionA six-month lifestyle intervention in women with obesity and infertility led to more frequent intercourse, better vaginal lubrication and overall sexual function 5 years after the intervention. (Trial Registration: NTR1530).