Despite anaerobic digestion having potential for pathogen reduction in sewage sludge, the behaviors of viruses as the primary health concern are rarely studied. This study investigated the inactivation kinetics and mechanisms of four typical virus surrogates with different structures in mesophilic (MAD) and thermophilic (TAD) anaerobic digestion of sludge. Virus inactivation in MAD was virus-type-dependent correspondingly to different function loss. Temperature drove the faster inactivation proceeding for enveloped Phi6, while temperature and ammonia were the critical inactivation factors for nonenveloped MS2, causing genome degradation and protein functional damage. Interaction with sludge solids played critical role in DNA viruses T4 and Phix174 inactivation via inducing host binding function damage. By comparison, TAD enhanced viral protein denaturation, bringing efficient inactivation with reducing heterogeneity among nonenveloped viruses. These insights into unique virus behaviors in anaerobic digestion systems can provide guidance for developing more effective disinfection protocols and improving sludge biosafety.