For decades, photoinhibited two-photon lithography (PI-TPL) has been continually developed and applied into versatile nanofabrication. However, ultrahigh precision fabrication on wafer by PI-TPL remains challenging, due to the lack of a refractive index (n) matched photoresist (Rim-P) with effective photoinhibition capacity for dip-in mode. In this paper, various Rim-P are developed and then screened for their applications in PI-TPL. In addition, different lithography methods (in terms of oil-mode and dip-in mode) are analyzed by use of optical simulations combined with experiments. Remarkably, one type of Rim-P (n = 1.518) shows effective photoinhibition capacity, which represents an outstanding breakthrough in the field of PI-TPL. In contrast to photoresist with an unsuitable refractive index, optical aberrations are almost completely eliminated in the dip-in mode by using the Rim-P. Consequently, features with a minimum critical dimension as small as 39 nm are successfully achieved on wafer by dip-in PI-TPL, which paves the way for subdiffraction silicon-based chip manufacturing by PI-TPL. Moreover, through a combination of the Rim-P and dip-in mode, the ability to achieve tall and high-precision three-dimensional nanostructures is no longer problematic.