X-ray detection plays an important role in medical imaging, scientific research, and security inspection. Recently, the β-Ga2O3 single-crystal-based X-ray detector has attracted extensive attention due to its excellent intrinsic properties such as good absorption for X-ray photons, a high breakdown electric field, high stability, and low cost. However, developing a high-performance β-Ga2O3-based X-ray detector remains a challenge because of the large dark current and the high oxygen vacancy concentration in the crystals. In this paper, we report a high-performance Mg-doped β-Ga2O3 single-crystal-based X-ray detector with a sandwich structure. The reduced dark current enables the detector to have a high sensitivity of 338.9 μC Gy-1 cm-2 under 50 keV X-ray irradiation with a dose rate of 69.5 μGy/s. The sensitivity is 16-fold higher than that of the commercial amorphous selenium detector. Furthermore, the reduced oxygen vacancy concentration can improve the response speed (<0.2 s) of the detector. The present studies provide a promising method to obtain the high performances for the X-ray detector based on β-Ga2O3 single crystals.