Traditional dye-sensitized solar cells (DSCs) use 4-tert-butylpyridine (4-TBP) as a nitrogen additive in the electrolyte to improve the photovoltaic performance. However, 4-TBP reacts with the ruthenium dye N719 (bis(tetrabutylammonium) salt of the cis-bis(isothiocyanato)bis (2,2′-bipyridyl-4,4′-dicarboxylato) ruthenium (II) (RuL2(NCS)2) complex at elevated temperatures, so the efficiency of the cells is reduced greatly. In this study, we tested 4,4′-dinonyl-2,2′-bipyridine (DNB) as a new nitrogen additive instead of 4-TBP in two types of electrolyte, i.e., liquid and ionic liquid, in order to improve the thermal stability of ruthenium dyes. The results showed that the reaction rate between DNB and N719 was relatively slow, and 10 times slower than that with 4-TBP at elevated temperatures. This clearly reduced the thermal degradation of N719. Two series of experiment were conducted at 80 °C from 0 to 1500 h with 7–8 samples per electrolyte. N719 and its degradation products were analyzed by High performance liquid chromatography (HPLC) coupled with Ultraviolet/Visible (UV/Vis) detector and Mass spectrometry (MS). After 1000 h, approximately 30% of N719 was degraded in the liquid electrolyte, whereas only 10% of the N719 was lost in the ionic electrolyte. DSCs prepared with 4-TBP and DNB to compare their photovoltaic performance. The results indicated that DSCs containing either 4-TBP or DNB had equivalent efficiencies of around 3.8%. Thus, DNB has the potential to replace 4-TBP as a nitrogen additive in DSCs.