Staphylococcus aureus (S. aureus) is one of the most common foodborne pathogens worldwide, which poses a great threat to public health. It is of utmost importance to develop rapid, simple, and sensitive methods for the determination of S. aureus. A signal-on photoelectrochemical (PEC) aptasensor is constructed herein based on titanium carbide (Ti3C2Tx)-Au nanobipyramids (NBPs)/ZnO nanoarrays (NRs). The reliability and capability of the PEC aptasensor make it suitable for the sensitive and selective determination of S. aureus. First, the electrostatically self-assembled Ti3C2Tx-Au NBP nanomaterial was coated on the ZnO NR surface by a spin-coating method. On the one hand, Ti3C2Tx-Au NBPs can broaden the spectral absorption of ZnO NRs, resulting in Ti3C2Tx-Au NBPs/ZnO NR composites that exhibit a wide range of absorption from the ultraviolet to the infrared region. On the other hand, Ti3C2Tx can reduce the agglomeration of nanoparticles, while Au NBPs can effectively fix the aptamer through the Au-S bond. Specifically, the experimental results show that when S. aureus is present, the Au NBPs-aptamer-S. aureus complex is shed from the electrode surface, altering the interfacial electron transfer model and reducing the steric hindrance. Consequently, an amplified photocurrent signal for the quantitative determination of S. aureus is obtained. Under optimal experimental conditions, a linear correlation is observed between the current response of the aptasensor and the logarithm of the S. aureus concentration (ranging from 1.0 to 1.0 × 106 CFU/mL), with an impressive detection limit as low as 0.5 CFU/mL. Furthermore, the aptasensor has been successfully employed for the detection of S. aureus in milk, with the recovery of 93.0%-99.0%. Hence, this research offers a novel approach for the detection of foodborne pathogens and other noxious substances.