Recently, there has been growing interest in using lightwave-driven scanning probe microscopy (LD-SPM) to break through the Abbe diffraction limit of focusing, yielding insight into various energy couplings and conversion processes and revealing the internal information of matter. We describe a compact and efficient optical cryostat designed for LD-SPM testing under magnetic fields. The exceptional multilayer radiation shielding insert (MRSI) forms an excellent temperature gradient when filled with heat conducting gas, which removes the requirement to install an optical window in the liquid helium cooling shell. This not only critically avoids the vibration and thermal drift caused by solid heat conduction but also minimizes light transmission loss. The application of gate valves and bellows allows a simpler and more effective replacement of the sample and working cell in the test cavity. ANSYS software is used for steady-state thermal analysis of the MRSI to obtain the temperature distribution and heat transfer rate, and the necessity of the flexible copper shielding strips is illustrated by the simulations. The topography and magnetic domain images of 45 nm-thick La0.67Ca0.33MnO3 thin films on NdGaO3(001) substrates under a magnetic field were obtained by a self-made lightwave-driven magnetic force microscope in this cryostat. The resolution and noise spectra during imaging reveal temperature stability and low vibration throughout the cryostat. The experience acquired during the development of this cryostat will help to establish cryostats of similar types for a variety of optic applications requiring the use of cryogenic temperatures.