It has been challenging to use biomass that is produced from heavy metals (HMs) polluted farmland. This work shows a possible way to achieve bioenergy recovery from the polluted biomass while limiting the environmental risks of collected HMs, which is important to phytoremediation chain of the heavy metal polluted farmland. Two representative grain sorghums, i.e., Chuannuo (CN) and Luzhouhong (LZH) varieties were selected for phytoremediation. The heavy metal distributions, anaerobic digestion performances of the biomass waste, heavy metals fates and risk in anaerobic digestion were investigated. Results indicated both Chuannuo (CN) and Luzhouhong (LZH) exhibited low accumulation of HMs due to their low bioconcentration factors (< 1). Most HMs were accumulated in their stover (leaf + stalk), in which 80.9% (Cu), 71.4% (Pb), 97.8% (Cr) and 99.1% (Cd) were observed for CN stover, while for LZH stover, the corresponding value was 78.4%, 85.1%, 98.9% and 97.8%, respectively. Anaerobic digestion of the collected stover were further performed which gave a high methane yield of 173.78 and 144.73 mL/g VS for CN and LZH, respectively. After digestion, more than 99% heavy metals were retained in the solid residue, in which residual state was increased by 7%-38%. Although Cd mobility and bioavailability were significantly reduced after anaerobic digestion, it should be cautious to soil application of solid residues due to their still relatively higher mobility and bioavailability. By contrast, Cu, Pb and Cr were more stable in the solid residues. The decreased mobility and bioavailability indicated that anaerobic digestion for methane production could potentially weaken the environmental risks of HMs that was remained in the biomass residues.