Diabetes mellitus (DM) is a group of metabolic diseases, which is of urgent need to develop new therapeutic DM oral drugs with less side effects and sound therapeutic efficacy. In this study, a Beta cell expansion factor A (BefA) production strain of Escherichia Coli BL21-pet 28C-BefA was constructed, and the anti-diabetes effect of BefAwas evaluated using type 1 diabetes mellitus (T1DM) and type 2 diabetes mellitus (T2DM) mice models. The T1DM mice results indicated that BefA significantly reduced the blood glucose level, exerted protective function of islet β cell morphology, down-regulated the TLR-4, p-NFκB/NFκB, Bax/Bcl-2 expressions and the secretion level of IL-1β, TNF-α, increased the expression of PDX-1 protein and insulin secretion in a concentration-dependent manner, and restored the disturbed microbial diversity to normal level. Similar with the T1DM mice, BefA obviously increased islet β cells, reduced inflammatory reaction and apoptosis in T2DM mice, and also improved liver lipid metabolism by down-regulating the expression of CEBP-α, ACC, Fasn and inhibiting the synthesis of triglyceride and induce Cpt-1, Hmgcs2, Pparα in a concentration-dependent manner. In the present study, we verified therapeutic effect and potential mechanisms of BefA in mammal for the first time, providing basic data for its clinical application.