β-lactam (BL) allergies are the most common drug allergy worldwide, but most are reported in error. BL allergies are also well-established risk factors for adverse drug events and antibiotic-resistant infections during inpatient health care encounters, but the understanding of the long-term outcomes of patients with BL allergies remains limited. To evaluate the long-term clinical outcomes of patients with BL allergies. This longitudinal retrospective cohort study was conducted at a single regional health care system in western Pennsylvania. Electronic health records were analyzed for patients who had an index encounter with a diagnosis of sepsis, pneumonia, or urinary tract infection between 2007 and 2008. Patients were followed-up until death or the end of 2018. Data analysis was performed from January 2022 to January 2024. The presence of any BL class antibiotic in the allergy section of a patient's electronic health record, evaluated at the earliest occurring observed health care encounter. The primary outcome was all-cause mortality, derived from the Social Security Death Index. Secondary outcomes were defined using laboratory and microbiology results and included infection with methicillin-resistant Staphylococcus aureus (MRSA), Clostridium difficile, or vancomycin-resistant Enterococcus (VRE) and severity and occurrence of acute kidney injury (AKI). Generalized estimating equations with a patient-level panel variable and time exposure offset were used to evaluate the odds of occurrence of each outcome between allergy groups. A total of 20 092 patients (mean [SD] age, 62.9 [19.7] years; 12 231 female [60.9%]), of whom 4211 (21.0%) had BL documented allergy and 15 881 (79.0%) did not, met the inclusion criteria. A total of 3513 patients (17.5%) were Black, 15 358 (76.4%) were White, and 1221 (6.0%) were another race. Using generalized estimating equations, documented BL allergies were not significantly associated with the odds of mortality (odds ratio [OR], 1.02; 95% CI, 0.96-1.09). BL allergies were associated with increased odds of MRSA infection (OR, 1.44; 95% CI, 1.36-1.53), VRE infection (OR, 1.18; 95% CI, 1.05-1.32), and the pooled rate of the 3 evaluated antibiotic-resistant infections (OR, 1.33; 95% CI, 1.30-1.36) but were not associated with C difficile infection (OR, 1.04; 95% CI, 0.94-1.16), stage 2 and 3 AKI (OR, 1.02; 95% CI, 0.96-1.10), or stage 3 AKI (OR, 1.06; 95% CI, 0.98-1.14). Documented BL allergies were not associated with the long-term odds of mortality but were associated with antibiotic-resistant infections. Health systems should emphasize accurate allergy documentation and reduce unnecessary BL avoidance.