AbstractSemiconductor p–n junctions are building blocks for optoelectronic devices. Recently, p–n junction devices based on 2D transition metal dichalcogenides (TMDCs) have been demonstrated in optoelectronic applications due to their thin thickness, flexibility, high carrier mobility, and high light‐absorption properties. To fabricate 2D semiconductor p–n junction devices, various methods are demonstrated, such as heterojunction structures, chemical doping, and electrostatic doping. In this work, lateral both p–n and n–p junctions in WSe2 devices, electrically controlled by using only a single‐gate electrode, are first reported. It is demonstrated that the single‐gated WSe2 p–n and n–p diodes form an internal built‐in electrical field, showing strong diode‐like current rectifying behavior and photovoltaic effect under the illumination. The resultant device exhibits a high current rectification ratio up to ≈106 and a power conversion efficiency of 0.1% under AM 1.5 illumination. A logical inverter based on the lateral and in‐plane contacted WSe2 device with a hexagonal boron nitride (h‐BN) gate dielectric is also presented. The electrode architecture engineering based on a single TMDC will be useful for applications that are more complicated such as p–n junction optoelectronic devices and inverters.