The complexity of biological systems poses a great challenge in the development of nanotheranostic agents with enhanced therapeutic efficacies. To systematically overcome a series of barriers during in vivo administration and achieve optimal antitumor activity, nanotheranostic agents that can self-adaptively change their properties in response to certain tumor-associated signals are highly preferable. Herein, gold nanoparticles with a mixed-charge zwitterionic surface (Au-MUA-TMA) is fabricated, which can undergo pH-triggered self-assembly for promoting tumor targeting and improving photoacoustic imaging (PAI)-guided photothermal tumor ablation. In blood and normal tissues, relatively small-sized Au-MUA-TMA can circulate stably, and upon arriving at the tumor sites, they quickly assemble into larger aggregates in an acidic tumor environment to ensure higher tumor accumulation and retention. Furthermore, the absorption band of Au-MUA-TMA can be remarkably shifted to the near-infrared (NIR) region, which effectively activates the photoacoustic (PA) signals of tumors and enhances photothermal therapy (PTT) with minimal side effects. This in vivo self-assembly strategy enables the nanotheranostic agents to better fulfill multiple requirements for in vivo application, thereby attaining advanced performances in cancer diagnosis and treatment.