The overuse of sulfamethoxazole (SMX) has caused serious damage to aquatic ecosystem and human health even at environmental concentration. In this study, various iron salts were used to functionalize sludge-derived biochar (SBC) to simultaneously boost its adsorption ability for SMX and magnetic collection performance. Afterward, ball milling was further employed to treat optimal iron salt (FeCl36H2O) functionalized SBC (MSBC) for enlarging its external-internal surface area, pore volume and exposing its functional groups. Ball milling coupled FeCl36H2O co-modified SBC (BMSBC) showed the desirable adsorption performance for SMX, and it was remarkably higher than those of SBC, ball milled SBC (BSBC), MSBC and other magnetization functionalized SBC. The maximum adsorption capacity of BMSBC calculated by Langmuir model was 2.24 x 104 mu g/g, and it showed the optimum adsorption performance at pH = 3 and 5. The multiple physicochemical forces including 7C-7C conjugation, pore filling, H-bonding (dipole-dipole and Yoshida), Fe-O complexation and electrostatic interactions were confirmed as the dominant driving mechanism controlling SMX adsorption onto BMSBC by adsorption models fitting, water chemistry effect experiments, characterization analysis and DFT calculation. The greater magnetic sensitivity guaranteed it was easily collected within 1 min, also was beneficial for its reuse by NaOH regeneration. The favorable adsorption ability for SMX in actual waters and good environmental safety of BMSBC allowed it to be a viable adsorbent, in addition to the disposal approach for sludge.