For each generation of semiconductors, the issue of doping techniques is always placed at the top of the priority list since it determines whether a material can be used in the electronic and optoelectronic industry or not. When it comes to 2D materials, significant challenges have been found in controllably doping 2D semiconductors into p‐ or n‐type, let alone developing a continuous control of this process. Here, a unique self‐modulated doping characteristic in 2D layered materials such as PtSSe, PtS0.8Se1.2, PdSe2, and WSe2 is reported. The varying number of vertically stacked‐monolayers is the critical factor for controllably tuning the same material from p‐type to intrinsic, and to n‐type doping. Importantly, it is found that the thickness‐induced lattice deformation makes defects in PtSSe transit from Pt vacancies to anion vacancies based on dynamic and thermodynamic analyses, which leads to p‐ and n‐type conductance, respectively. By thickness‐modulated doping, WSe2 diode exhibits a high rectification ratio of 4400 and a large open‐circuit voltage of 0.38 V. Meanwhile, the PtSSe detector overcomes the shortcoming of large dark‐current in narrow‐bandgap optoelectronic devices. All these findings provide a brand‐new perspective for fundamental scientific studies and applications.