Optical imaging holds great promise for monitoring bacterial infectious processes and drug resistance with high temporal-spatial resolution. Currently, the diagnosis of deep-seated bacterial infections in vivo with fluorescence imaging, including near-infrared (NIR) fluorescence imaging technology, remains a significant challenge due to its limited tissue penetration depth. In this study, we developed a highly specific targeting probe, Cy7-Neo-NO2, by conjugating a bacterial 16S rRNA-targeted moiety, neomycin, with a bacterial nitroreductase (NTR)-activated NIR photoacoustic (PA) scaffold using our previously developed caged photoinduced electron transfer (a-PeT) approach. This conjugation effectively resolved probe aggregation issues in physiological conditions and substantially enhanced its reactivity toward bacterial NTR. Notably, Cy7-Neo-NO2 enabled the first in situ photoacoustic imaging of pneumonia induced by methicillin-resistant Staphylococcus aureus (MRSA), as well as the detection of bacteria within tumors. Furthermore, upon NIR irradiation, Cy7-Neo-NO2 successfully inhibited MRSA growth through a synergistic effect combining photothermal therapy and photodynamic therapy. Our results provided an effective tool for obtaining exceptional PA agents for accurate diagnosis, therapeutic evaluation of deep-seated bacterial infections in vivo, and intratumoral bacteria-specific recognition.