MicroRNAs, including microRNA‐7 (miR‐7), are important modulators of numerous gene expressions and the related biological processes. Melatonin is a key hormone regulating daily and seasonal rhythms, in which a variety of positive and negative regulatory factors, such as norepinephrine (NE) and leptin, are involved. However, the interactions among these factors and the mechanisms remain to be elucidated. The aims of the present study were to identify the functions and the related mechanisms of miR‐7 in regulating melatonin synthesis and secretion through in vitro and in vivo experiments in pineal gland of pigs, which is an important animal model for agricultural and biomedical studies. Our results firstly show that miR‐7 is specifically expressed in porcine pinealocytes and negatively regulates melatonin synthesis. The further functional studies show that the dynamic expression levels of miR‐7 are contrary to the melatonin levels throughout the day, and the forced inhibition of endogenous miR‐7 in porcine pinealocytes sharply increases arylalkylamine N‐acetyltransferase (AANAT) expression by 80.0% (P = 0.0031) and melatonin levels by 81.0% (P = 0.0421), whereas miR‐7 over‐expression down‐regulates AANAT expression by 38.6% (P = 0.0004) and melatonin levels by 37.6% (P = 0.0212). In addition, the miR‐7 expression is up‐regulated by leptin through the JAK/STAT3 signaling pathway, and the in vivo intracerebroventricular injection of leptin increases miR‐7 expression by 80.0% (P = 0.0044) in porcine pineal glands and reduces melatonin levels by 57.1% (P = 0.0060) compared with the controls. This functional inhibition of melatonin synthesis by miR‐7 is accomplished by its binding to the 3′‐UTR of Raf1. Further, our results demonstrate that the RAF1/MEK/ERK signaling pathway mediates NE‐induced AANAT expression, whereas leptin attenuates NE's function through miR‐7. Taken together, the results demonstrated that leptin activates the JAK/STAT3 signaling pathway to increase the expression of miR‐7, which acts as a negative regulatory molecule inhibiting NE‐activated RAF1/MEK/ERK signaling pathway by targeting Raf1, resulting in decreased AANAT expression and melatonin synthesis. These findings suggest that miR‐7 is a novel negative regulator of melatonin synthesis and links leptin‐ and NE‐mediated signaling pathways in porcine pineal glands, which will contribute to our understanding in the establishment of the biological rhythms resulting from melatonin.