Global population growth and changing diets have exacerbated protein supply-demand imbalances, driving the need for sustainable waste valorization and alternative protein sources. Black soldier fly larvae (BSFL) bioconversion addresses these challenges by transforming food waste into nutrient-rich insect biomass and organic fertilizers. However, variability in food waste composition necessitates further study of its effects on BSFL performance. This study investigated how substrate composition influences BSFL bioconversion efficiency, nutrient recovery, and gut microbiota dynamics, focusing on two urban waste streams defined by China's national classification policy: restaurant food waste and household food waste. The results showed that T2 (RFW:HFW = 3:1) achieved an optimal balance between larval productivity and nutrient recovery while lowering frass salinity. T3 (RFW:HFW = 1:1) exhibited the highest nitrogen recovery efficiency (92.78 %) and larval protein content (42.40 %). In practice, the mixing ratio can be tailored to specific valorization goals, such as maximizing biomass yield or protein production. Microbiota analysis of the BSFL gut revealed that increasing HFW proportion correlated with a higher abundance of cellulose-degrading genera (e.g., Dysgonomonas, Actinomyces). T3 was enriched in Klebsiella, a genus known for its role in nitrogen cycling. Although functional prediction (Tax4Fun) showed that the core metabolic functions of the gut microbiota were conserved across treatments, FAPROTAX analysis suggested that the HFW-RFW blends increased the abundance of OTUs associated with nitrogen metabolism. These findings demonstrate that RFW-HFW blending strategic can effectively optimize BSFL production performance and enhance nutrient recovery, addressing sustainable waste management challenges and offering policymakers a flexible, science-based solution.