Background: Interest in the use of cannabis and cannabinoids to treat chronic non-cancer pain is increasing, because of their potential to reduce opioid dose requirements. We aimed to investigate cannabis use in people living with chronic non-cancer pain who had been prescribed opioids, including their reasons for use and perceived effectiveness of cannabis; associations between amount of cannabis use and pain, mental health, and opioid use; the effect of cannabis use on pain severity and interference over time; and potential opioid-sparing effects of cannabis. Methods: The Pain and Opioids IN Treatment study is a prospective, national, observational cohort of people with chronic non-cancer pain prescribed opioids. Participants were recruited through community pharmacies across Australia, completed baseline interviews, and were followed up with phone interviews or self-complete questionnaires yearly for 4 years. Recruitment took place from August 13, 2012, to April 8, 2014. Participants were asked about lifetime and past year chronic pain conditions, duration of chronic non-cancer pain, pain self-efficacy, whether pain was neuropathic, lifetime and past 12-month cannabis use, number of days cannabis was used in the past month, and current depression and generalised anxiety disorder. We also estimated daily oral morphine equivalent doses of opioids. We used logistic regression to investigate cross-sectional associations with frequency of cannabis use, and lagged mixed-effects models to examine temporal associations between cannabis use and outcomes. Findings: 1514 participants completed the baseline interview and were included in the study from Aug 20, 2012, to April 14, 2014. Cannabis use was common, and by 4-year follow-up, 295 (24%) participants had used cannabis for pain. Interest in using cannabis for pain increased from 364 (33%) participants (at baseline) to 723 (60%) participants (at 4 years). At 4-year follow-up, compared with people with no cannabis use, we found that participants who used cannabis had a greater pain severity score (risk ratio 1·14, 95% CI 1·01–1·29, for less frequent cannabis use; and 1·17, 1·03–1·32, for daily or near-daily cannabis use), greater pain interference score (1·21, 1·09–1·35; and 1·14, 1·03–1·26), lower pain self-efficacy scores (0·97, 0·96–1·00; and 0·98, 0·96–1·00), and greater generalised anxiety disorder severity scores (1·07, 1·03–1·12; and 1·10, 1·06–1·15). We found no evidence of a temporal relationship between cannabis use and pain severity or pain interference, and no evidence that cannabis use reduced prescribed opioid use or increased rates of opioid discontinuation. Interpretation: Cannabis use was common in people with chronic non-cancer pain who had been prescribed opioids, but we found no evidence that cannabis use improved patient outcomes. People who used cannabis had greater pain and lower self-efficacy in managing pain, and there was no evidence that cannabis use reduced pain severity or interference or exerted an opioid-sparing effect. As cannabis use for medicinal purposes increases globally, it is important that large well designed clinical trials, which include people with complex comorbidities, are conducted to determine the efficacy of cannabis for chronic non-cancer pain. Funding: National Health and Medical Research Council and the Australian Government.