Construction of in-plane p-n junction with clear interface by using homogenous materials is an important issue in two-dimensional transistors, which have great potential in the applications of next-generation integrated circuit and optoelectronic devices. Hence, a controlled and facile method to achieve p-n interface is desired. Molybdenum sulfide (MoS 2 ) has shown promising potential as an atomic-layer ntype semiconductor in electronics and optoelectronics. Here, we developed a facile and reliable approach to in-situ transform n-type MoS 2 into p-type MoO 3 to form lateral p-n junction via a KI/I 2 solution-based chemical oxidization process. The lateral MoS 2 /MoO 3 p-n junction exhibits a highly efficient photoresponse and ideal rectifying behavior, with a maximum external quantum efficiency of~650%, 3.6 mA W −1 at 0 V, and a light switching ratio of~10 2 . The importance of the built-in p-n junction with such a high performance is further confirmed by high-resolution photocurrent mapping. Due to the high photoresponse at low source-drain voltage (V DS ) and gate voltage (V G ), the formed MoS 2 /MoO 3 junction p-n diode shows potential applications in low-power operating photodevices and logic circuits. Our findings highlight the prospects of the local transformation of carrier type for high-performance MoS 2 -based electronics, optoelectronics and CMOS logic circuits.