Sliding Mode Control (SMC) is a robust control strategy that is insensitive to system uncertainties and external disturbances. It is widely used in designing controllers, observers and differentiators. However, the inevitable chattering problem affects the SMC applications in real-life engineering. This paper presents an improved SMC algorithm based on discrete second-order time optimal control (TOC). The proposed algorithm adopts a simple method to calculate the distance from the state variable to the sliding surface, and it can adjust the linear or nonlinear control law according to the calculated distance. On the other hand, the control law deviation in the two-step reachable region is corrected. The improved control algorithm shortens the convergence time and reduces the chattering problem of the system. It is applied to the design of magnetic suspension controllers. This allows the system to achieve a fast, accurate and stable suspension target when the system has external disturbances and internal parameter perturbations. INDEX TERMS Discrete time systems, time optimal control, sliding mode control, reduction chattering, boundary layer, and magnetic suspension system