The negatively charged nitrogen-vacancy (NV) center in diamond is a widely-used platform in the rapidly growing field of quantum technologies. In particular, NV centers near the surface of the diamond can offer nanoscale resolution as they can be brought into proximity of the sample. However, these shallow single NV centers experience considerable noise from the surface in addition to the perturbation from the spin bath in the bulk diamond crystal. This lowers the spin coherence and lifetimes leading to limited sensing capabilities. This work presents a two-step approach to improve both the spin initialization/readout and the spin manipulation processes by applying optimization algorithms to the laser and microwave controls. The goal is to increase the NV's readout contrast aiming for control pulses that are robust against power variation. With the assistance of feedbackbased (closed-loop) optimization, limitations imposed by experimental imperfections and unknown system parameters are inherently considered. For pulsed ODMR-measurements, the optimization leads to sensitivities staying below 1 µT Hz − 1 2 for an 83% decrease in the control power, increasing the robustness by approximately one third compared to the original sequence. Furthermore, we report sensitivities below 100 nT Hz − 1 2 for Ramsey measurements, where optimized control pulses result in a two-fold improvement in the sensitivity. Both schemes were optimized for DC magnetic field sensing over a large range of control amplitudes. Such optimized sensing schemes are suitable for a variety of magnetometry setups that require robustness, e.g. (inhomogeneous) ensembles of NV centers, or NV scanning probes operating at different distances from the MW antenna.