The construction of heterostructure photoelectrodes can enhance the performance of photoelectrochemical (PEC) sensors. However, it is still a critical challenge to achieve efficient transfer of interface carriers. In this paper, we propose a strategy of “photo-modulated interface charge” to design a PEC sensor based on a hollow hexagonal tubular In2S3/AgInS2 in situ Z-type heterojunction for the susceptible detection of Programmed Death-ligand 1 (PD-L1). The hollow structured In2S3/AgInS2 is ingeniously synthesized employing indium-sourced MIL-68 as a sacrificial template and in situ cation exchange technique. This composite material has close contact interfaces due to in situ growth, which facilitates the spontaneous establishment of a robust and stable built-in electric field between the interfaces. Moreover, the inner cavity structure promotes multiple light refractions and scatterings, significantly enhancing light trapping capability. Under the influence of both light irradiation and electric field force, the migration direction of the interfacial charge is reversed, forming a Z-transfer path, which effectively delays the compounding of the electron-hole pairs (e-/h+) and further improves the sensitivity of the sensor. The minimum detection threshold of the PEC sensor is 26.58 fg/mL, and the feasibility of real samples is investigated, providing new insights for early diagnosis and prognostic treatment of diseases.