Sepsis is a common acute and severe medical condition with a high mortality rate. Anoikis, an emerging form of cell death, plays a significant role in various diseases. However, the role of anoikis in sepsis remains poorly understood. Based on the datasets from Gene Expression Omnibus and anoikis-related genes from GeneCards, the differentially expressed anoikis-related genes (DEARGs) were identified. Based on hub genes of DEARGs, a novel prognostic risk model was constructed, and the pattern of immune infiltration was investigated by CIBERSORT algorithm. And small molecule compounds targeting anoikis in sepsis were analyzed using Autodock. Of 23 DEARGs, CXCL8, CFLAR, FASLG and TP53 were significantly associated with the prognosis of sepsis (P < 0.05). Based on the prognostic risk model constructed with these four genes, high-risk population of septic patients had significant lower survival probability than low-risk population (HR = 3.30, P < 0.001). And the level of CFLAR was significantly correlated with the number of neutrophils in septic patients (r = 0.54, P < 0.001). Moreover, tozasertib had low binding energy with CXCL8, CFLAR, FASLG and TP53, and would be a potential compound for sepsis. Conclusively, our results identified a new prognostic model and potential therapeutic molecular for sepsis, providing new insights on mechanism and treatment of sepsis.