We use a combined 1.2 Ms of $NuSTAR$ observations of M31 to search for X-ray lines from sterile neutrino dark matter decay. For the first time in a $NuSTAR$ analysis, we consistently take into account the signal contribution from both the focused and unfocused fields of view. We also reduce the modeling systematic uncertainty by performing spectral fits to each observation individually and statistically combining the results, instead of stacking the spectra. We find no evidence of unknown lines, and thus derive limits on the sterile neutrino parameters. Our results place stringent constraints for dark matter masses $gtrsim 12$ keV, which reduces the available parameter space for sterile neutrino dark matter produced via neutrino mixing ($e.g.$, in the $ u$MSM) by approximately one-third. Additional $NuSTAR$ observations, together with improved low-energy background modeling, could probe the remaining parameter space in the future. Lastly, we also report model-independent limits on generic dark matter decay rates and annihilation cross sections.