Transglutaminase (TG) catalyzes protein-protein crosslinking, which has important and diverse roles in vertebrates and invertebrates. Here we demonstrate that Drosophila TG crosslinks drosocrystallin, a peritrophic matrix protein, to form a stable fiber structure on the gut peritrophic matrix. RNA interference (RNAi) of the TG gene was highly lethal in flies and induced apoptosis of gut epithelial cells after oral infection with Pseudomonas entomophila. Moreover, AprA, a metalloprotease secreted by P. entomophila, digested non-crosslinked drosocrystallin fibers, but not drosocrystallin fibers crosslinked by TG. In vitro experiments using recombinant drosocrystallin and monalysin proteins demonstrated that monalysin, a pore-forming exotoxin of P. entomophila, was adsorbed on the crosslinked drosocrystallin fibers in the presence of P. entomophila culture supernatant. In addition, gut-specific TG-RNAi flies had a shorter lifespan than control flies after ingesting P. entomophila, whereas the lifespan after ingesting AprA-knockout P. entomophila was at control levels. We conclude that drosocrystallin fibers crosslinked by TG, but not non-crosslinked drosocrystallin fibers, form an important physical barrier against exotoxins of invading pathogenic microbes.