A novel temperature-compensated magnetic field sensor based on a ring erbium-doped fiber laser combined with a fiber Bragg grating (FBG) and a Sagnac loop containing a microfiber coupler (MFC) and magnetic fluid is proposed and investigated. Thanks to the dual-ring structure of the MFC-Sagnac loop and the FBG-assisted resonant cavity, the output of the structure has two distinct laser peaks. In addition to the magnetic field sensing capability, the proposed structure can simultaneously provide temperature information. The maximum experimentally demonstrated sensitivity to a magnetic field determined from the spectral shift of one laser peak is 102 pm/mT in the magnetic field range from 0 to 60 mT. The spectral position of the other laser peak is independent of the magnetic field but shifts toward longer wavelengths with temperature with a sensitivity of 18 pm/°C. The proposed magnetic field sensor is advantageous for applications requiring measurement accuracy over a wide magnetic field range with a compensating of temperature information.