Flexible self-powered sensing is urgently needed for wearable, portable, sustainable, maintenance-free and long-term applications. Here, we developed a flexible and self-powered GaN membrane-based ultraviolet (UV) photoswitch with high on/off ratio and excellent sensitivity. Even without any power supply, the driving force of UV photogenerated carriers can be well boosted by the combination of both built-in electric field and piezoelectric polarization field. The asymmetric metal-semiconductor-metal structure has been elaborately utilized to enhance the carrier separation and transport for highly sensitive UV photoresponse. Its UV on/off ratio and detection sensitivity reach to 4.67 × 10(5) and 1.78 × 10(12) cm·Hz(0.5) W(1-), respectively. Due to its excellent mechanical flexibility, the piezoelectric polarization field in GaN membrane can be easily tuned/controlled based on piezo-phototronic effect. Under 1% strain, a stronger and broader depletion region can be obtained to further enhance UV on/off ratio up to 154%. As a result, our research can not only provide a deep understanding of local electric field effects on self-powered optoelectronic detection, but also promote the development of self-powered flexible optoelectronic devices and integrated systems.