Phototherapy has great application prospects in superficial tumors, such as melanoma, esophageal cancer, and breast carcinoma, owing to the advantages of noninvasiveness, high spatiotemporal selectivity, and less side effects. However, classical phototherapies including photodynamic and photothermal therapy still need to settle the bottleneck problems of poor efficacy, inevitable thermal damage, and a high rate of postoperative recurrence. In this study, we developed a nanocomposite with excellent optical properties and immune-stimulating properties, termed PBP@CpG, which was obtained by functionalizing black phosphorus (BP) with polydopamine and further adsorbing CpG. Benefiting from the protection of polydopamine against BP, ideal light absorption, and photoacoustic conversion properties, PBP@CpG not only enables precisely delineation of the tumor region with photoacoustic imaging but also powerfully disrupts the plasma membrane and cytoskeleton of tumor cells with a photoacoustic cavitation effect. In addition, we found that the photoacoustic cavitation effect was also capable of inducing immunogenic cell death and remarkably strengthening the antitumor immune response upon cooperating with immune adjuvant CpG. Therefore, PBP@CpG was expected to provide a promising nanoplatform for optical theranostics and herald a new strategy of photoimmunotherapy based on the photoacoustic cavitation effects and immunostimulatory effect.