The anomalous photovoltaic effect inherent in ferroelectric materials brings promising opportunities for self-powered photoelectric detectors. However, the photoelectric detection performances in photoferroelectrics are limited by the low photocurrent output due to the recombination and low separation ability of photogenerated carriers. This work proposes a heterogeneous integration technology for self-powered photoelectric detectors by designing a P-type/N-type/P-type (PNP) ferroelectric junction with sandwich structure, in which not only the photogenerated carrier separation is strengthened due to the enhanced polarization derived from the interface compressive stress, but also the carrier recombination is suppressed by the built-in electric field in the depletion layer. Thus, the photocurrent output in the PNP heterojunction is increased by more than seven times at 0 V bias compared with N-type ferroelectric film and exhibits excellent responsivity and detectivity. The temperature stability for repeatable time-resolved self-powered photocurrent demonstrates applicability in high temperature environments. This work provides a feasible strategy for high-performance self-powered photoelectric detectors by heterogeneous integration in photoferroelectrics, promoting ferroelectric photonic applications.