For the seismic safety of tunnels with cavity behind lining, based on the finite element method, the viscoelastic artificial boundaries are introduced to study the influence of the location of cavity behind lining on the seismic response of tunnel structure under vertically incident SV wave. The analysis results show that the cavity behind the lining has a significant effect on the seismic response of tunnel structure, and the appearance of cavity behind lining will significantly change the dynamic characteristics of tunnel structure; when the incidence frequency of wave is close to the natural vibration frequency of tunnel structure, the lining stress has the largest amplification when the cavity appears behind the vault; Regardless of the cavity location, the maximum of lining stresses always appears at the arched foot, and the vault stress has the largest amplification; Under the Taft wave, the maximum stress 1.642 MPa of lining without cavity appears at the arched foot, and the minimum 0.118MPa at the arched waist, the stress amplification at the vault can reach about 760 %, which is unfavorable to tunnels. In addition, the soil property also has a great influence on the tunnel; the layered site will lead to the obvious change of the seismic wave, hence the geological data should be collected in detail in the seismic design of tunnel. Meanwhile it is proposed that the PE material can be filled back into the cavities behind the tunnel lining to reduce the earthquake damage of tunnels.