Carbon materials are effective substitutes for Pt counter electrodes (CEs) in dye-sensitized solar cells (DSSCs). However, many of these materials, such as carbon nanotubes and graphene, are expensive and require complex preparation process. Herein, waste lignin, recycled from hazardous black liquors, is used to create oxygen-nitrogen-sulfur codoped carbon microspheres for use in DSSC CEs through the facile process of low-temperature preoxidation and high-temperature self-activation. The large number of ester bonds formed by preoxidation increase the degree of cross-linking of the lignin chains, leading to the formation of highly disordered carbon with ample defect sites during pyrolysis. The presence of organic O/N/S components in the waste lignin results in high O/N/S doping of the pyrolysed carbon, which increases the electrolyte ion adsorption and accelerates the electron transfer at the CE/electrolyte interface, as confirmed by density functional theory (DFT) calculations. The presence of inorganic impurities enables the construction of a hierarchical micropore-rich carbon structure through the etching effect during self-activation, which can provide abundant catalytically active sites for the reversible adsorption/desorption of electrolyte ions. Under these synergistic effects, the DSSCs that use this novel carbon CE achieve a quite high power-conversion efficiency of 9.22%. To the best of our knowledge, the value is a new record reported so far for biomass-carbon-based DSSCs.