A large amount of agro-industrial residues are produced from the planting, production and processing of traditional Chinese herbs. As a tonic, edible, and economical herb, Codonopsis pilosula root has been extensively developed into medicine and functional food. However, thousands of tons of aerial parts (stems, leaves, flowers and fruits) have been directly discarded after harvest each year. To utilise agro-wastes, Pleurotus ostreatus was cultivated on a basal substrate supplemented with C. pilosula stems and leaves (CSL). Physicochemical analyses revealed that the basal substrate mixed with CSL was more abundant in cellulose, hemicellulose, and most of micronutrients such as K, Ca, Mg, S, Fe, Zn and Mo. After the first flush, the fruit bodies in CSL group exhibited a higher fresh weight, a wider average pileus diameter and a lower moisture level. Nutrition analyses presented a higher protein content and a lower fat content in mushrooms from CSL group compared with control group. Interestingly, 14 amino acids (glutamine, arginine, valine, leucine, and etc.) and 3 micronutrients (Se, Fe and Zn) were increased after CSL addition to the substrate. Based on untargeted metabolomics, a total of 710 metabolites were annotated. Compared with control group, there were 142 and 117 metabolites significantly increased and decreased in the CSL group. Most of them were grouped into classes of amino acids and peptids, fatty acids, carbohydrates, terpenoids, and etc. Moreover, an abundance of phytometabolites from Codonopsis were detected in P. ostreatus from CSL group, including polyacetylenes or polyenes, flavonoids, alkaloids, terpenoids, organic acids, and etc. UPLC-MS/MS results demonstrated that lobetyolin content in the CSL group samples was 0.0058%. In summary, the aerial parts of C. pilosula processed for use in the production of edible mushroom is an emerging strategy to converting agricultural waste into functional foods.