According to one embodiment, a magnetic disk device includes magnetic disks, a plurality of magnetic heads, and a control unit. A plurality of magnetic heads each includes a heat-assist unit which applies a preheating current of such magnitude that data already written to the magnetic disk is not erased to a near-field optical element for the preheat time. The control unit measures the time elapsing from a start of write to the time when a value of an index indicating the quality of a recording signal of data written by the magnetic head converges to within a first threshold range, and adjusts the preheat time for each of the magnetic heads in such a manner that the measured lapse time becomes less than or equal to a second threshold.