Human embryonic stem cells (ESCs) and human induced pluripotent stem cells hold great promise for cell-based therapies and drug discovery. However, homogeneous differentiation remains a major challenge, highlighting the need for understanding developmental mechanisms. We performed genome-scale CRISPR screens to uncover regulators of definitive endoderm (DE) differentiation, which unexpectedly uncovered five Jun N-terminal kinase (JNK)-JUN family genes as key barriers of DE differentiation. The JNK-JUN pathway does not act through directly inhibiting the DE enhancers. Instead, JUN co-occupies ESC enhancers with OCT4, NANOG, SMAD2 and SMAD3, and specifically inhibits the exit from the pluripotent state by impeding the decommissioning of ESC enhancers and inhibiting the reconfiguration of SMAD2 and SMAD3 chromatin binding from ESC to DE enhancers. Therefore, the JNK-JUN pathway safeguards pluripotency from precocious DE differentiation. Direct pharmacological inhibition of JNK significantly improves the efficiencies of generating DE and DE-derived pancreatic and lung progenitor cells, highlighting the potential of harnessing the knowledge from developmental studies for regenerative medicine.