Background: Numerous studies have shown that pyroptosis is associated with sepsis progression, which can lead to dysregulated host immune responses and organ dysfunction. Therefore, investigating the potential prognostic and diagnostic values of pyroptosis in patients with sepsis is essential. Methods: We conducted a study using bulk and single-cell RNA sequencing (scRNA-seq) from the Gene Expression Omnibus database to examine the role of pyroptosis in sepsis. Univariate logistic analysis, least absolute shrinkage, and selection operator regression analysis were used to identify pyroptosis-related genes (PRGs), construct a diagnostic risk score model, and evaluate the selected genes' diagnostic value. Consensus clustering analysis was used to identify the PRG-related sepsis subtypes with varying prognoses. Functional and immune infiltration analyses were used to explain the subtypes' distinct prognoses, and scRNA-seq data were used to differentiate immune-infiltrating cells and macrophage subsets and study cell-cell communication. Results: A risk model was established based on 10 key PRGs (NAIP, ELANE, GSDMB, DHX9, NLRP3, CASP8, GSDMD, CASP4, APIP, and DPP9), of which four (ELANE, DHX9, GSDMD, and CASP4) were associated with prognosis. Two subtypes with different prognoses were identified based on the key PRG expressions. Functional enrichment analysis revealed diminished nucleotide oligomerization domain-like receptor pathway activity and enhanced neutrophil extracellular trap formation in the subtype with a poor prognosis. Immune infiltration analysis suggested a different immune status between the two sepsis subtypes, with the subtype with a poor prognosis exhibiting stronger immunosuppression. The single-cell analysis identified a macrophage subpopulation characterized by gasdermin D (GSDMD) expression that may be involved in pyroptosis regulation, which was associated with the prognosis of sepsis. Conclusion: We developed and validated a risk score for sepsis identification based on 10 PRGs, four of which also have potential value in the prognosis of sepsis. We identified a subset of gasdermin D macrophages associated with poor prognosis, providing new insights into the role of pyroptosis in sepsis.