Objectives We aimed to explore the impact of adherence to Life's Simple 7 (LS7) metrics on risk of obstructive sleep apnea (OSA), and the impact of inflammation on the association, in adults in the United States.Methods Data from 13,825 community-dwelling adults aged ≥ 20 years recruited in the National Health and Nutrition Examination Surveys (NHANES) 2005–2008, 2015–2018 was analyzed. The LS7 score was calculated based on the AHA definition of LS7 metrics. The diagnosis of OSA was based on self-reported symptoms of sleep disturbance using a standard questionnaire. The Multivariable Apnea Prediction (MAP) Index score was also calculated to assess the risk of OSA. Log-binominal regression and negative binomial regression were performed to estimate the associations between LS7 and OSA and MAP index, with odds ratios (ORs) and prevalence ratios (PRs) and their 95% confidence intervals (CIs) calculated. Mediation analysis was performed to estimate the mediating effects of inflammatory indicators on the associations.Results A total of 4473 participants (32.4%) had OSA, and the mean MAP index was 0.39. In fully adjusted log-binominal regression models, with total score < 6 as the reference, the ORs (95% CIs) for risk of OSA were 0.90 (0.73, 1.10), 0.76 (0.65, 0.89), 0.78 (0.64, 0.95), and 0.45 (0.38, 0.54) for total score = 6, total score = 7, total score = 8, and total score > 8, respectively (P for trend < 0.001). When LS7 score was analyzed as a continuous variable, each 1-point increase in LS7 score was associated with a 15% decrease in OSA risk (P < 0.001). In negative binominal regression models, the adjusted PRs (95% CIs) for the MAP index were 0.93 (0.90, 0.97), 0.87 (0.84, 0.91), 0.80 (0.77, 0.84), and 0.55 (0.53, 0.57) for total score = 6, total score = 7, total score = 8, and total score > 8, respectively (P for trend < 0.001). For each 1-point increase in LS7 score, the risk of OSA decreased by 13% (P < 0.001). Consistent results were observed in subgroup analysis. Mediation analysis indicated that inflammatory factors, including blood cell count, neutrophil count, and C-reactive protein, positively mediated the association of LS7 with OSA, with a mediation proportion of 0.022 (P = 0.04), 0.02 (P = 0.04), and 0.02 (P = 0.02), respectively.Conclusions In a nationally representative sample of US adults, adherence to LS7 metrics was independently associated with reduced OSA risk. Inflammation plays a mediating role in the association between LS7 and OSA.