Pregnancy causes abrupt thymic atrophy. This atrophy is characterized by a severe decrease in the number of all thymocyte subsets and qualitative (but not quantitative) changes in thymic epithelial cells (TECs). Pregnancy-related thymic involution is triggered by progesterone-induced functional changes affecting mainly cortical TECs (cTECs). Remarkably, this severe involution is rapidly corrected following parturition. We postulated that understanding the mechanisms of pregnancy-related thymic changes could provide novel insights into signaling pathways regulating TEC function. When we analyzed genes whose expression in TECs was modified during late pregnancy, we found a strong enrichment in genes bearing KLF4 transcription factor binding motifs. We, therefore, engineered aPsmb11-iCre : Klf4lox/loxmouse model to study the impact of TEC-specificKlf4deletion in steady-state conditions and during late pregnancy. Under steady-state conditions,Klf4deletion had a minimal effect on TEC subsets and did not affect thymic architecture. However, pregnancy-induced thymic involution was much more pronounced in pregnant females lackingKlf4expression in TECs. These mice displayed a substantial ablation of TECs with a more pronounced loss of thymocytes. Transcriptomic and phenotypic analyses ofKlf4-/-TECs revealed thatKlf4maintains cTEC numbers by supporting cell survival and preventing epithelial-to-mesenchymal plasticity during late pregnancy. We conclude thatKlf4is essential for preserving TEC’s integrity and mitigating thymic involution during late pregnancy.