Objective: Compare vitamin D levels in opioid dependence and control population and adjust for relevant confounding effects. Nuclear hormone receptors (including the vitamin D receptor) have been shown to be key transducers and regulators of intracellular metabolism and comprise an important site of pathophysiological immune and metabolic dysregulation potentially contributing towards pro-ageing changes observed in opioid-dependent patients (ODPs). Design: Longitudinal prospective comparing ODPs with general medical controls (GMCs). Setting Primary care. Participants: Prospective review comparing 1168 ODP (72.5% men) and 415 GMC (51.6% men, p<0.0001). Mean ages were 33.92±0.31 (mean±SEM) and 41.22±1.32 years, respectively (p<0.0001). Opioid use in the ODP has been previously reported and shown to be typical. Interventions Nil. Observational study only. Primary and secondary outcomes Serum vitamin D levels and relevant biochemical parameters. Results: Vitamin D levels were higher in the ODP (70.35±1.16 and 57.06±1.81 nmol/L, p<0.0001). The difference in ages between the two groups was handled in an age-matched case-control subanalysis and also by multiple regression. Sexes were analysed separately. The age:status (or age:time:status) was significant in case-control, cross-sectional and longitudinal analyses in both sexes (p<0.05). Modelled vitamin D was 62.71 vs 57.81 nmol/L in the two groups. Time-dependent mixed-effects models quadratic in age outperformed linear-only models (p=0.0377). ODP vitamin D was shown to vary with age and to correlate with alanine aminotransferase establishing it as a biomarker of age in this group. Hepatitis C seronegativity was significant in regression models (from p=0.0015). Conclusion Vitamin D was higher in ODP in both sexes in bivariate, cross-sectional, case-control and longitudinal analyses and was robust to the inclusion of metabolic and immune biomarkers. That Hepatitis C seronegativity was significant suggests opioid dependence has an effect beyond simply that of its associated hepatitides. This finding may relate to the accelerated ageing process previously described in opioid dependence. © Article author(s) (or their employer(s) unless otherwise stated in the text of the article) 2018. All rights reserved. No commercial use is permitted unless otherwise expressly granted.