In this paper, we study the codebook-based near-field beam training for intelligent reflecting surfaces (IRSs) aided wireless system. In the considered model, the near-field beam training is critical to focus signals at the location of user equipment (UE) to obtain prominent IRS array gain. However, existing codebook schemes cannot achieve low training overhead and high receiving power simultaneously. To tackle this issue, a novel two-layer codebook based beam training scheme is proposed. The layer-1 codebook is designed based on the omnidirectionality of a random-phase beam pattern, which estimates the UE distance with training overhead equivalent to that of one DFT codeword. Then, based on the estimated UE distance, the layer-2 codebook is generated to scan candidate UE locations and obtain the optimal codeword for IRS beamforming. Numerical results show that compared with benchmarks, the proposed two-layer beam training scheme achieves more accurate UE distance and angle estimation, higher data rate, and smaller training overhead.