The electronic structures of the two-dimensional transition-metal dichalcogenide nanosheets under different out-of-plane pressure were investigated by using the first principle calculations. The band-gaps of all the nanosheets (thickness = 2, 4 and 6 layers) decrease with increasing pressure and finally close, indicating a semiconductor–metal transition. The critical pressure for the semiconductor–metal transition is larger for the thinner nanosheets, and the band-gap closes faster for the Mo-containing nanosheets than the W-containing ones. By taking bilayer MoS 2 as an example, it was found that the physical mechanism of the band-gap variation relates to the charge accumulation and delocalization in the interlayer region.