Prolonged culture of metaphase II oocytes is an in vitro aging process that compromises oocyte quality. We tested whether melatonin preserves epigenetic modifications in oocytes after prolonged culture. The porcine oocytes were maturated in vitro for 44 h, and then metaphase II oocytes were continuously cultured in medium supplemented with or without melatonin for 24 h. We found that the parthenogenetic blastocyst formation rate of prolonged-culture oocytes was lower than in fresh oocytes. We further observed that methylation at H3K4me2 and H3K27me2 of oocytes enhanced after prolonged culture. However, 5mc fluorescence intensity was lower in prolonged-culture oocytes than in fresh oocytes. Moreover, the promoter of the imprinted gene NNAT exhibited a higher level of DNA methylation in prolonged-culture oocytes than in fresh oocytes, which was associated with a reduced expression level and glucose uptake capability. Conversely, melatonin improved blastocyst formation rate and preserved histone and DNA methylation modifications, as well as NNAT function in the oocytes after prolonged culture. Notably, DNA methyltransferase inhibitor 5-aza significantly attenuated the protective role of melatonin on genomic DNA methylation. In summary, our results revealed that epigenetic modifications are disrupted in oocytes after prolonged culture, but the changes are reversed by melatonin.