We extended existing theory of the two-pulse electric-dipole echo in glasses in a magnetic field to the three-pulse echo. As is well known, at low temperatures two-level systems (TLS's) are responsible for the echo phenomenon in glasses. Using a diagram technique in the framework of perturbation theory we derived a simple formula for the three-pulse echo amplitude. As in the case of two-pulse echo the magnetic field dependence of the tree-pulse echo amplitude in glasses is related to quadrupole electric moments of TLS's non-spherical nuclei and/or dipole-dipole interaction of their nuclear spins. These two mechanisms are responsible for the fine level splitting of TLS. As a result TLS transforms to multi-level system with the fine level splitting depending on a magnetic field. Due to existence in the theory the additional parameter T - the time interval between the second and the third pulses we have more reach spectrum of echo oscillations in a magnetic field in comparison with the case of the two-pulse echo.