The article considers mathematical model of the light-to-dark situation in the Earth-Moon system and its influence on controlling the motion of a spacecraft equipped with low-thrust engines. All transfers were analyzed within the framework of the limited three-body problem. Mathematical model of spacecraft transfers between L1 and L2 libration points is described in the barycentric coordinate system. Disturbances originating from the Earth, the Moon and the Sun were taken into account and included polar compression of the Earth and the Moon, oscillations of the Earth around the barycenter, influence of other planets of the Solar system, inclination of the Moon's plane to the mean plane of the Moon, as well as shadow zones created by the Earth and the Moon. The optimal control program was obtained using the Fedorenko sequential linearization method for finding the derivatives and the gradient method for optimizing control laws. As a result of optimization, control laws corresponding to trajectory and values of the total transfer time duration were obtained.