The present invention relates to a formulation containing melatonin in stable form, obtained through hot granulation at a temperature of 80°C for 10 minutes in the presence of derivatives of glycerides of behenic acid. The present invention also relates to formulations in bilayer tablet form, wherein the active ingredient is present in both layers, but with different release profiles.