Background The US opioid epidemic has led to similar concerns about prescribed opioids in the UK. In new users, initiation of or escalation to more potent and high dose opioids may contribute to long-term use. Additionally, physician prescribing behaviour has been described as a key driver of rising opioid prescriptions and long-term opioid use. No studies to our knowledge have investigated the extent to which regions, practices, and prescribers vary in opioid prescribing whilst accounting for case mix. This study sought to (i) describe prescribing trends between 2006 and 2017, (ii) evaluate the transition of opioid dose and potency in the first 2 years from initial prescription, (iii) quantify and identify risk factors for long-term opioid use, and (iv) quantify the variation of long-term use attributed to region, practice, and prescriber, accounting for case mix and chance variation. Methods and findings A retrospective cohort study using UK primary care electronic health records from the Clinical Practice Research Datalink was performed. Adult patients without cancer with a new prescription of an opioid were included; 1,968,742 new users of opioids were identified. Mean age was 51 ± 19 years, and 57% were female. Codeine was the most commonly prescribed opioid, with use increasing 5-fold from 2006 to 2017, reaching 2,456 prescriptions/10,000 people/year. Morphine, buprenorphine, and oxycodone prescribing rates continued to rise steadily throughout the study period. Of those who started on high dose (120–199 morphine milligram equivalents [MME]/day) or very high dose opioids (≥200 MME/day), 10.3% and 18.7% remained in the same MME/day category or higher at 2 years, respectively. Following opioid initiation, 14.6% became long-term opioid users in the first year. In the fully adjusted model, the following were associated with the highest adjusted odds ratios (aORs) for long-term use: older age (≥75 years, aOR 4.59, 95% CI 4.48–4.70, p < 0.001; 65–74 years, aOR 3.77, 95% CI 3.68–3.85, p < 0.001, compared to, In this analysis of electronic health records, Meghna Jani and colleagues investigate how opioids are prescribed in UK primary care patients., Author summary Why was this study done? Whilst opioid prescribing for non-cancer pain has risen in the US and Canada, trends over time are less clear in the UK. No studies to our knowledge have evaluated how opioid dose/potency changes over time in UK patients started an opioid for the first time for non-cancer pain, to assess escalation, tapering, and long-term use. Physician prescribing behaviour has been implicated as a key driver of rising opioid prescriptions and long-term opioid use; however, this needs to be interpreted in the context of regional and individual patient differences. The association of region, practice, prescriber, and individual factors with long-term opioid use is highly important, as this has implications for policy and future targeted public health interventions. What did the researchers do and find? We conducted a study of 1,968,742 new opioid users without cancer from primary care electronic health records across the UK. We found that between 2006 and 2017 codeine was the most commonly prescribed opioid: There was a 5-fold increase in codeine prescriptions, a 7-fold increase in tramadol prescriptions, and a 30-fold increase in oxycodone prescriptions for non-cancer pain. Prescribing factors (e.g., high dose/potency of opioid or concurrent gabapentinoid use), older age, higher socioeconomic deprivation score, and other conditions including fibromyalgia, rheumatological conditions, history of substance abuse, suicide/self-harm, alcohol abuse, and major surgery were associated with long-term opioid use. After accounting for individual patient factors, the North West, Yorkshire and the Humber, and South West regions of England were associated with a higher risk of long-term opioid use. Whilst there were only 3.5% of prescribers who had significantly higher prescribing practices leading to long-term use after adjustment of patient factors, where they did, rates were up to 3.5 times higher than the population average. What do these findings mean? Clinicians should take care in prescribing high dose opioids at initiation and closely monitor those with the above individual factors for long-term use. The variation observed across regions, practices, and prescribers after adjustment for patient factors supports calls for action to reduce such variation and harmonise prescribing practices.