The prevalence of obesity has grown rapidly over the past several decades and has been accompanied by an increase in the prevalence of chronic pain and prescription opioid use. Obesity, through its association with pain, may represent an important contributor to opioid use. This cross-sectional study investigated the relationship between obesity and prescription opioid use among adults aged 35 to 79 years using data from the National Health and Nutrition Examination Survey (NHANES, 2003-2016). Relative to normal weight, body mass indices in the overweight {odds ratio (OR), 1.11 (confidence interval [CI], 0.88-1.39)}, obese I (OR, 1.26 [CI, 1.01-1.57]), obese II (OR, 1.69 [CI, 1.34-2.12]), and obese III (OR, 2.33 [CI, 1.76-3.08]) categories were associated with elevated odds of prescription opioid use. The association between excess weight and opioid use was stronger for chronic opioid use than for use with a duration of less than 90 days (P-value, <0.001). We estimated that 14% (CI, 9%-19%) of prescription opioid use at the population level was attributable to obesity, suggesting there might have been 1.5 million fewer opioid users per year under the hypothetical scenario where obese individuals were instead nonobese (CI, 0.9-2.0 million users). Back pain, joint pain, and muscle/nerve pain accounted for the largest differences in self-reported reasons for prescription opioid use across obesity status. Although interpretation is limited by the cross-sectional nature of the associations, our findings suggest that the obesity epidemic may be partially responsible for the high prevalence of prescription opioid use in the United States.