The realization of p-n homojunctions, which can be achieved via spatially controlled carrier-type modulation, remains a challenge for two-dimensional transition metal dichalcogenides. Here, we report an effective method to tune intrinsic n-type few-layer MoSe2 to p-type through controlling precisely the ultraviolet-ozone treatment time, which can be attributed to the surface charge transfer from the underlying MoSe2 to MoOx (x < 3). The resulting hole mobility and concentration are ∼20.1 cm2 V-1 s-1 and ∼1.9 × 1012 cm-2, respectively, and the on-off ratio is ∼105, which are comparable to the values of pristine n-type MoSe2. Moreover, the lateral p-n homojunction prepared by partially treating MoSe2 displays a high rectification ratio of 2.4 × 104, an ideality factor of 1.1, and a high photoresponsivity of 0.23 A W-1 to the 633 nm laser at Vd = 0 V and Vg = 0 V due to the built-in potential in the p-n homojunction area. Our findings ensure the MoSe2 p-n diode as a promising candidate for future low-power operating photodevices.