We previously demonstrated that oral application of the recombinant single-domain antibody fragment (VHH) clone K609, directed against Escherichia coli F4 fimbriae, reduced E. coli-induced diarrhoea in piglets, but only at high VHH doses. We have now shown that a large portion of the orally applied K609 VHH is proteolytically degraded in the stomach. Stringent selection for proteolytic stability identified seven VHHs with 7- to 138-fold increased stability after in vitro incubation in gastric fluid. By DNA shuffling we obtained four clones with a further 1.5- to 3-fold increased in vitro stability. These VHHs differed by at most ten amino acid residues from each other and K609 that were scattered over the VHH sequence and did not overlap with predicted protease cleavage sites. The most stable clone, K922, retained 41% activity after incubation in gastric fluid and 90% in jejunal fluid. Oral application of K922 to piglets confirmed its improved proteolytic stability. In addition, K922 bound to F4 fimbriae with higher affinity and inhibited fimbrial adhesion at lower VHH concentrations. K922 is thus a promising candidate for prevention of piglet diarrhoea. Furthermore, our findings could guide selection and improvement by genetic engineering of other recombinant antibody fragments for oral use.