Most hospitalized patients with inflammatory bowel disease (IBD) experience pain. Despite the known risks associated with opioids in IBD including risk for misuse, overdose, infection, readmission, and even death, opioid use is more prevalent in IBD than any other chronic gastrointestinal condition. Most hospitalized IBD patients receive opioids; however, opioids have not been shown to improve pain during hospitalization. We conducted a randomized controlled trial in hospitalized patients with IBD to evaluate the impact of a proactive opioid-sparing analgesic protocol. Wearable devices measured activity and sleep throughout their hospitalization. Chronic opioid users, post-operative, and pregnant patients were excluded. The primary endpoint was a change in pain scores from admission to discharge. Secondary endpoints included opioid use, functional activity, sleep duration and quality, and length of stay. Of 329 adults with IBD evaluated for eligibility, 33 were enrolled and randomized to the intervention or usual care. Both the intervention and control group demonstrated significant decreases in pain scores from admission to discharge (- 2.6 ± 2.6 vs. - 3.0 ± 3.2). Those randomized to the intervention tended to have lower pain scores than the control group regardless of hospital day (3.02 ± 0.90 vs. 4.29 ± 0.81, p = 0.059), used significantly fewer opioids (daily MME 11.8 ± 15.3 vs. 30.9 ± 42.2, p = 0.027), and had a significantly higher step count by Day 4 (2330 ± 1709 vs. 1050 ± 1214; p = 0.014). There were no differences in sleep duration, sleep quality, readmission, or length-of-stay between the two groups. A proactive analgesic protocol does not result in worsening pain but does significantly reduce opioid-use in hospitalized IBD patients.Clinical trial registration number: NCT03798405 (Registered 10/01/2019).© 2023. The Author(s).