Bacteria naturally form communities of cells known as biofilms. However the physiological roles of biofilms produced by non-pathogenic microbiota remain largely unknown. To assess the impact of a biofilm on host physiology we explored the effect of several non-pathogenic biofilm-forming bacteria on Caenorhabditis elegans. We show that biofilm formation by Bacillus subtilis, Lactobacillus rhamnosus and Pseudomonas fluorescens induces C. elegans stress resistance. Biofilm also protects against pathogenic infection and prolongs lifespan. Total mRNA analysis identified a set of host genes that are upregulated in response to biofilm formation by B. subtilis. We further demonstrate that mtl-1 is responsible for the biofilm-mediated increase in oxidative stress resistance and lifespan extension. Induction of mtl-1 and hsp-70 promotes biofilm-mediated thermotolerance. ilys-2 activity accounts for biofilm-mediated resistance to Pseudomonas aeruginosa killing. These results reveal the importance of non-pathogenic biofilms for host physiology and provide a framework to study commensal biofilms in higher organisms.