This study examined the effects of pinealectomy in Wistar rats and melatonin replacement therapy on the daily mRNA expression of melatonin (Tph1, Aanat, Asmt, Mt1, Mt2, and Rorα), and steroidogenic (Star, 17βhsd3, and Lhr) related genes as well as clock genes (Rev-erbα, Bmal1, Per1, Per2, Cry1, and Cry2) in testes. The testes of control animals express the Tph1, Aanat, and Asmt and Per2 genes with 24-h rhythms in mRNA, reaching the maximal values during the dark phase. Pinealectomy abolished and melatonin treatment restored the 24-h rhythmicity. Daytime differences in mRNA expression were significant for Star, Lhr, Mt1, Mt2, Rorα, Rev-erbα, Bmal1, Cry1, and Cry2 genes in testes of control rats. Conversely, 17βhsd3 and Per1 mRNA expression did not show a daytime difference in testes of control animals. Pinealectomy abolished the peak time of Mt1 and Mt2 mRNA expression, phase shifted the peak time of Star, Rorα, Rev-erbα, Bmal1, and Cry2 mRNA expression, downregulated the 24-h Lhr mRNA expression, and inverted the peak time of Per1, Per2, and Cry1 mRNA expression to the light phase. The melatonin replacement therapy completely restored the control levels of Lhr, Rev-erbα, and Per1 mRNA expression patterns, partially restored the daily control of Star, Mt2, Rorα, Bmal1, Cry1, and Cry2 mRNA expression but did not re-establish the daily control of Mt1 mRNA expression. This suggests that the daily mRNA expression of these genes is probably driven by pineal melatonin and melatonin treatment restores (partially or completely) the daily control of gene expression patterns.