Here we report the increase of the coherence time T$_2$ of a single electron spin at room temperature by using dynamical decoupling. We show that the Carr-Purcell-Meiboom-Gill (CPMG) pulse sequence can prolong the T$_2$ of a single Nitrogen-Vacancy center in diamond up to 2.44 ms compared to the Hahn echo measurement where T$_2 = 390 \mu$s. Moreover, by performing spin locking experiments we demonstrate that with CPMG the maximum possible $T_2$ is reached. On the other hand, we do not observe strong increase of the coherence time in nanodiamonds, possibly due to the short spin lattice relaxation time $T_1=100 \mu$s (compared to T$_1$ = 5.93 ms in bulk). An application for detecting low magnetic field is demonstrated, where we show that the sensitivity using the CPMG method is improved by about a factor of two compared to the Hahn echo method.