The exaltation of light-harvesting efficiency and the inhibition of fast charge recombination are pivotal to the improvement of photoelectrochemical (PEC) performance. Herein, a direct Z-scheme heterojunction is designed of Cu2S/CdIn2S4 by in situ growth of CdIn2S4 nanosheets on the surface of hollow CuS cubes and then annealing at 400°C. The constructed Z-scheme heterojunction is demonstrated with electron paramagnetic resonance and redox couple (p-nitrophenol/p-aminophenol) measurements. Under illumination, it shows the photocurrent 6 times larger than that of hollow Cu2S cubes, and affords outstanding PEC performance over the known Cu2S and CdIn2S4-based photocatalysts. X-ray photoelectron spectroscopy and density functional theory results demonstrate a strong internal electric field formed in Cu2S/CdIn2S4 Z-scheme heterojunction, which accelerates the Z-scheme charge migration, thereby promoting electron-hole separation and enhancing their utilization efficiency. Moreover, the hollow structure of Cu2S is conducive to shortening the charge transport distance and improving light-harvesting capability. In proof-of-concept PEC application, a PEC detection method for miRNA-141 based on the sensitivity of benzo-4-chloro-hexadienone to light absorption on Cu2S/CdIn2S4 modified electrode is developed with good selectivity and a limit of detection of 32 aM. This work provides a simple approach for designing photoactive materials with highly efficient PEC performance.