Antibiotics residues are still an important and noticeable issue, and realizing the ultra-sensitive, sample, and rapid detection of residual antibiotics in the environment is the basis for evaluating and monitoring the pollution status. Herein, a new bimetallic PtNi nanozyme-driven dual-amplified photoelectrochemical (PEC) aptasensor was developed for sulfamethazine (SMZ) assay based on the superior photosensitive material of Z-scheme heterostructured Co9S8@ In doped CdS nanotubes (Co9S8@In-CdS NTs). In this protocol, bimetallic alloyed nanotube PtNi was introduced as the mimic enzyme to instead of bio-enzyme for constructing of signal amplification strategy. On the basis of the outstanding photosensitivity of Co9S8@In-CdS NTs and highly catalytic property of PtNi nanozyme, the proposed PEC aptasensor exhibits a wide linear range of 0.05 pg mL–1 ~ 1.0 ng mL–1, and a low detection limit of 37.2 fg mL–1. This work put forwards a novel approach for the accurate analysis of antibiotics in the environment.