Tunneling with neighboring soil void is a particular challenge for underground railway construction in karst terrain. To reduce the disturbance to neighboring soil voids generated by the TBM and to secure the TBM from sudden settlement, axis deviation and ground collapse, it's necessary to conduct TBM tunneling parameters optimization. Aiming at the existing circumstances that TBM tunneling parameters are mostly determined by engineering experiences, a mechanical model based on Mindlin solution is built and an optimal control problem about excavation rate is proposed using the excavation rate regarded as a controlled variable, and the variation of energy density is regarded as the performance index. The problem is then solved using Gradient method. This optimization method has been introduced to the construction of a TBM tunnel in Line 9,Guangzhou Railway System. The results indicate that the model proposed in this study can effectively reflect the disturbance at the top of neighboring soil voids caused by bulkhead thrust in TBM tunneling. The optimization based on optimal excavation rate control problem agrees with engineering experiences.