Abstract Ultraviolet photodetectors (UV PDs) are widely used in civilian, scientific, and military fields due to their high sensitivity and low false alarm rates. We present a temperature-dependent Lewis acid p-type doping method for transition metal dichalcogenides (TMDs), which can effectively be used to extend the optical response range. The p-type doping based on surface charge transfer involves the chemical adsorption of the Lewis acid SnCl4 as a light absorption layer on the surface of WS2, significantly enhancing its UV photodetection performance. Under 365 nm laser irradiation, WS2 PDs exhibit response speed of 24 ms/20 ms, responsivity of 660 mA/W, detectivity of 3.3 × 1011 Jones, and external quantum efficiency of 226%. Moreover, we successfully apply this doping method to other TMDs materials (such as MoS2, MoSe2, and WSe2) and fabricate WS2 lateral p–n heterojunction PDs.