Abundances of light elements in dwarf stars of different ages are important constraints for stellar yields, Galactic chemical evolution and exoplanet chemical composition studies. We have measured C and N abundances and 12C/13C ratios for a sample of 63 solar twins spanning a wide range in age, based on spectral synthesis of a comprehensive list of CH A-X and CN B-X features using HARPS spectra. The analysis of 55 thin disc solar twins confirms the dependences of [C/Fe] and [N/Fe] on [Fe/H]. [N/Fe] is investigated as a function of [Fe/H] and age for the first time for these stars. Our derived correlation [C/Fe]–age agrees with works for solar-type stars and solar twins, but the [N/Fe]–age correlation does not. The relations [C,N/Fe]–[Fe/H] and [C,N/Fe]–age for the solar twins lay under solar. 12C/13C is found correlated with [Fe/H] and seems to have decreased along the evolution of the local thin disc. Predictions from chemical evolution models for the solar vicinity corroborate the relations [C,N/Fe]–[Fe/H], 12C/13C–age, and [N/O]–[O/H], but do not for the 12C/13C–[Fe/H] and [C/O]–[O/H] relations. The N/O ratio in the Sun is placed at the high end of the homogeneous distribution of solar twins, which suggests uniformity in the N–O budget for the formation of icy planetesimals, watery superearths, and giant planets. C and N had different nucleosynthetic origins along the thin disc evolution, as shown by the relations of [C/N], [C/O], and [N/O] against [O/H] and age. [C/N] and [C/O] are particularly observed increasing in time for solar twins younger than the Sun