The integrated process of mechanochemical fractionation-assisted and solar-driven electrochemical reforming, followed by biological funnelling, enables the efficient upcycling of sewage sludge. This process not only co-produces valuable single-cell protein and green hydrogen but also effectively removes heavy metal contaminants.