We investigate the thermal entanglement of Heisenberg-type coupled two-qubit system in the presence of two controllable magnetic fields (B+b) and (B-b). We find that under the condition of low temperature and uniform magnetic field, the entanglement between the two qubits exhibits platform-like behavior. By controlling the inhomogeneous magnetic field b and selecting suitable material we can optimize the thermal entanglement and enhance the critical temperature Tc of dead entanglement. We also find that the entanglement switch can be realized in a broader region of temperature by modulating the uniform field B.