The opioid crisis is impacting people across the country and deserves attention to be able to curb the rise in opioid-related deaths. To evaluate practice patterns in opioid infusion administration and dosing for patients with acute respiratory failure receiving invasive mechanical ventilation. Retrospective cohort study. Patients from 21 hospitals in Kaiser Permanente Northern California and 96 hospitals in Philips electronic ICU Research Institute. We assessed whether patients received opioid infusion and the dose of said opioid infusion. We identified patients with a diagnosis of acute respiratory failure who were initiated on invasive mechanical ventilation. From each patient, we determined if opioid infusions were administered and, among those who received an opioid infusion, the median daily dose of fentanyl infusion. We used hierarchical regression models to quantify variation in opioid infusion use and the median daily dose of fentanyl equivalents across hospitals. We included 13,140 patients in the KPNC cohort and 52,033 patients in the eRI cohort. A total of 7,023 (53.4%) and 16,311 (31.1%) patients received an opioid infusion in the first 21 days of mechanical ventilation in the KPNC and eRI cohorts, respectively. After accounting for patient- and hospital-level fixed effects, the hospital that a patient was admitted to explained 7% (95% CI, 3-11%) and 39% (95% CI, 28-49%) of the variation in opioid infusion use in the KPNC and eRI cohorts, respectively. Among patients who received an opioid infusion, the median daily fentanyl equivalent dose was 692 µg (interquartile range [IQR], 129-1341 µg) in the KPNC cohort and 200 µg (IQR, 0-1050 µg) in the eRI cohort. Hospital explained 4% (95% CI, 1-7%) and 20% (95% CI, 15-26%) of the variation in median daily fentanyl equivalent dose in the KPNC and eRI cohorts, respectively. In the context of efforts to limit healthcare-associated opioid exposure, our findings highlight the considerable opioid exposure that accompanies mechanical ventilation and suggest potential under and over-treatment with analgesia. Our results facilitate benchmarking of hospitals' analgesia practices against risk-adjusted averages and can be used to inform usual care control arms of analgesia and sedation clinical trials.