Antibiotics in poultry feed are banned in many countries owing to their side effects, and insects containing antimicrobial peptides are proven to have potential as antibiotic alternatives in such feed. Thus, the primary objective of this study was to investigate the effects of dietary housefly maggot extract (HME) as the biofunctional material for antibiotic replacement in laying hens. The biofunctional properties of HME on egg production, egg quality, blood biomarkers of immune function, and microbiota were evaluated over a period of 40 to 50 weeks in laying hens under a digital livestock system. A total of 120 forty-week-old Hyline Brown laying hens were randomly divided into four groups with thirty replicates as follows: no added HME (CON), positive control (PC, 8 ppm of avilamycin), 100 ppm of HME (HME100), and 150 ppm of HME (HME150). Egg production and egg weight increased significantly in the HME150, HME100, PC, and CON groups (P < 0.05), but there were no differences between the HME and PC groups. Egg quality, such as eggshell thickness, eggshell strength, Haugh unit, and albumin height, were significantly improved in the HME and PC groups than in the CON group (P < 0.05). A blood biomarker of immune function, IgG, was significantly higher in the HME and PC groups than the CON group (P < 0.05), but there were no differences between the HME and PC groups. Blood corticosterone and heterophil to lymphocyte ratio were significantly lower in the HME and PC groups than in the CON group (P < 0.05). Microbiota Lactobacillus in the faeces were significantly higher in the HME and PC groups than in the CON group (P < 0.05). The faecal total aerobic bacteria, Escherichia coli, and coliform counts were significantly lower in the HME and PC groups than in the CON group (P < 0.05). Consequently, the HME showed the same significant effects as antibiotics on improving egg production and egg quality in laying hens. These results show that 100 ppm of HME can be used as a biofunctional material for an effective alternative to antibiotics in laying hens under a digital livestock system to improve egg production and quality by stimulating their immune functions and balancing the microbiota populations.