The co-pyrolysis of municipal sludge (MS) and papermaking sludge (PS) is beneficial for improving the quality of co-pyrolysis biochar and the stability of heavy metals in it. This study investigated the synergistic effect of co-pyrolysis of MS and PS, as well as the influence of different mass ratios (1:9, 3:7, 5:5, 7:3, and 9:1; MS:PS) and pyrolysis temperatures (400–600 ℃) on the physicochemical properties of pyrolysis char, chemical speciation of heavy metals, and their potential ecological risk index. Furthermore, thermodynamic equilibrium calculations were used to study the transformation and stabilization mechanisms of heavy metals during co-pyrolysis. The results indicated that the addition of PS increased the comprehensive pyrolysis index of MS (by 2.09–16.72 times) and the specific surface area of co-pyrolysis char. The inclusion of MS effectively promoted the transformation of heavy metals from unstable fractions to stable fraction, significantly reducing the potential ecological risk index of pyrolysis biochar (by 21.93–41.58 %). The combination of thermodynamic equilibrium calculations and experimental data demonstrated that heavy metals in sludge could be stabilized through the formation of stable heavy metal compounds or their encapsulation within the lattice of inorganic components during co-pyrolysis. These findings suggest that co-pyrolysis of MS and PS is a feasible and promising approach for producing high-quality pyrolysis char with low risk of heavy metals.