Converting abundant agricultural residues to valuable products, such as biochar, is a pressing challenge for society. Here, our objective has been to produce biochar-based fertilizers (BBFs) with high carbon stability, high yield, and characteristics favorable for their use in soils. Thus, H3PO4 with and without MgO was co-pyrolyzed with coffee husk and poultry litter. Proximate analysis, total phosphorus and magnesium, biochar yield, carbon retention, and thermal and chemical carbon stability were assessed. The BBFs were slightly acidic (pH similar to 6.0) and showed high contents of total P (146-206 g kg(-1)) and total Mg (96-98 g kg(-1)), similar to commercial fertilizers. Biochar yield increased up to 65% when treated with H3PO4 and H3PO4-MgO, resulting in up to 78% greater carbon retention. BBFs showed higher thermal stability, by thermogravimetric analysis and muffle oxidation, when compared to corresponding pristine biochars. Conversely, the addition of H3PO4-MgO decreased the chemical stability (higher H2O2 and K2Cr2O7 oxidation), compared to the biochars, because of the increase in surface area and reactivity. We concluded that the co-pyrolysis of biomasses with H3PO4 and MgO promoted thermal stabilization (increased yield) and increased chemical oxidation, because of increased surface area and reduced crystallinity of the BBFs.