Injecting-related bacterial and fungal infections are associated with significant morbidity and mortality among people who inject drugs (PWID), and they are increasing in incidence. Following hospitalization with an injecting-related infection, use of opioid agonist treatment (OAT; methadone or buprenorphine) may be associated with reduced risk of death or rehospitalization with an injecting-related infection. Data came from the Opioid Agonist Treatment Safety (OATS) study, an administrative linkage cohort including all people in New South Wales, Australia, who accessed OAT between July 1, 2001 and June 28, 2018. Included participants survived a hospitalization with injecting-related infections (i.e., skin and soft-tissue infection, sepsis/bacteremia, endocarditis, osteomyelitis, septic arthritis, or epidural/brain abscess). Outcomes were all-cause death and rehospitalization for injecting-related infections. OAT exposure was classified as time varying by days on or off treatment, following hospital discharge. We used separate Cox proportional hazards models to assess associations between each outcome and OAT exposure. The study included 8,943 participants (mean age 39 years, standard deviation [SD] 11 years; 34% women). The most common infections during participants' index hospitalizations were skin and soft tissue (7,021; 79%), sepsis/bacteremia (1,207; 14%), and endocarditis (431; 5%). During median 6.56 years follow-up, 1,481 (17%) participants died; use of OAT was associated with lower hazard of death (adjusted hazard ratio [aHR] 0.63, 95% confidence interval [CI] 0.57 to 0.70). During median 3.41 years follow-up, 3,653 (41%) were rehospitalized for injecting-related infections; use of OAT was associated with lower hazard of these rehospitalizations (aHR 0.89, 95% CI 0.84 to 0.96). Study limitations include the use of routinely collected administrative data, which lacks information on other risk factors for injecting-related infections including injecting practices, injection stimulant use, housing status, and access to harm reduction services (e.g., needle exchange and supervised injecting sites); we also lacked information on OAT medication dosages. Following hospitalizations with injection drug use-associated bacterial and fungal infections, use of OAT is associated with lower risks of death and recurrent injecting-related infections among people with opioid use disorder.