Melatonin (N-acetyl-5-methoxytrypamine) is the vertebrate hormone of the night: circulating levels at night are markedly higher than day levels. This increase is driven by precisely regulated increases in acetylation of serotonin in the pineal gland by arylalkylamine N-acetyltransferase (AANAT), the penultimate enzyme in the synthesis of melatonin. This unique essential role of AANAT in vertebrate timekeeping is recognized by the moniker the timezyme. AANAT is also found in the retina, where melatonin is thought to play a paracrine role. Here, we focused on the evolution of AANAT in early vertebrates. AANATs from Agnathans (lamprey) and Chondrichthyes (catshark and elephant shark) were cloned, and it was found that pineal glands and retinas from these groups express a form of AANAT that is compositionally, biochemically, and kinetically similar to AANATs found in bony vertebrates (VT-AANAT). Examination of the available genomes indicates that VT-AANAT is absent from other forms of life, including the Cephalochordate amphioxus. Phylogenetic analysis and evolutionary rate estimation indicate that VT-AANAT evolved from the nonvertebrate form of AANAT after the Cephalochordate-Vertebrate split over one-half billion years ago. The emergence of VT-AANAT apparently involved a dramatic acceleration of evolution that accompanied neofunctionalization after a duplication of the nonvertebrate AANAT gene. This scenario is consistent with the hypotheses that the advent of VT-AANAT contributed to the evolution of the pineal gland and lateral eyes from a common ancestral photodetector and that it was not a posthoc recruitment.