The intestinal mucus barrier prevents pathogen invasion and maintains host-microbiota homeostasis. We show that fatty acid synthase (FAS), an insulin-responsive enzyme essential for de novo lipogenesis, helps maintain the mucus barrier by regulating Mucin 2, the dominant mucin in the colon and a central component of mucus. Inducible Cre recombinase-directed inactivation of the FAS gene in the colonic epithelium of mice is associated with disruptions in the intestinal mucus barrier as well as increased intestinal permeability, colitis, systemic inflammation, and changes in gut microbial ecology. FAS deficiency blocked the generation of palmitoylated Mucin 2, which must be S-palmitoylated at its N terminus for proper secretion and function. Furthermore, a diabetic mouse model exhibited lower FAS levels and a decreased mucus layer, which could be restored with insulin treatment. Thus, the role of FAS in maintaining intestinal barrier function may explain the pathogenesis of intestinal inflammation in diabetes and other disorders.