To investigate the ability of the ratio of blood urea nitrogen (BUN) to serum albumin ratio (BAR) in patients with sepsis in intensive care units (ICUs) to predict the prognosis of short-and long-term death. Data are from the Marketplace for Intensive Care Medical Information IV (MIMIC-IV v2.0) database for patients with sepsis as defined by SEPSIS-3. The primary outcome was 30-day mortality and the secondary outcome was 360-day mortality. Kaplan–Meier (KM) survival curves were plotted to describe differences in BAR mortality in different subgroups and area under the curve (AUC) analysis was performed to compare the predictive value of sequential organ failure assessment (SOFA), BAR, blood urea nitrogen (BUN) and albumin. Multivariate Cox regression models and subgroup analysis were used to determine the correlation between BAR and 30-day mortality and 360-day mortality. A total of 7656 eligible patients were enrolled in the study with a median BAR of 8.0 mg/g, including 3837 in the ≤ 8.0 group and 3819 in the BAR > 8.0 group, with 30-day mortality rates of 19.1% and 38.2% (P< 0.001) and 360-day mortality rates of 31.1% and 55.6% (P< 0.001). Multivariate Cox regression models showed an increased risk of death for 30-day mortality (HR = 1.219, 95% CI 1.095–1.357;P< 0.001) and 360-day mortality (HR = 1.263, 95% CI 1.159–1.376;P< 0.001) in the high BAR group compared to the low BAR group. For the 30-day outcome, the area under the curve (AUC) was 0.661 for BAR and 0.668 for 360-day BAR. In the subgroup analysis, BAR remained an isolated risk factor for patient death. As a clinically inexpensive and readily available parameter, BAR can be a valuable forecaster of prognosis in patients with sepsis in the intensive care unit.