Long-term monitoring of weak changes in the magnetic field in the deep part of the Earth allows to detect anomalies related to the pre-natural disaster stage at the onset of the deformation of the Earth's crust. However, standard electronic instruments are unable to work under high temperatures (Hi-Temps) and high-pressure harsh environments for a long time. To address this problem, an in-well magnetic field measurement system, including a three-axis "residence times difference" fluxgate magnetometer, a heat exchange system with a coolant, and a control module, is designed. The measured maximum sensor sensitivity at room temperature is 0.02 s/(A/m). The rms input noise is within +/- 2 nT, corresponding to a noise spectral density of 200 pT/Hz1/2 at 1 Hz, that is sufficient to accurately detect the fluctuations of the geomagnetic field. The feasibility of the system was verified in laboratory at four temperatures, from 120 degrees C to 210 degrees C, corresponding to 2000-5000-m subsurface depths. When, in the experiments performed at 210 degrees C, the magnetic field was changed of some hundreds of nanotesla, the sensor outputs responded very well in the three directions, with a dynamic detectability of few tens of nanotesla. The control module maintains the internal temperature in the range 25 degrees C-40 degrees C when the external temperature varies between 120 degrees C and 210 degrees C, allowing a good long-term stability, as demonstrated by aging tests in laboratory. Finally, field experiments were conducted to verify the engineering feasibility of the system for ten days at 100-m depth and 15 degrees C-18 degrees C.