SB 10.45.29

tataś ca labdha-saṁskārau
 dvijatvaṁ prāpya su-vratau
gargād yadu-kulācāryād
 gāyatraṁ vratam āsthitau
Synonyms: 
tataḥ — then; ca — and; labdha — having received; saṁskārau — initiation (Kṛṣṇa and Balarāma); dvijatvam — twice-born status; prāpya — attaining; su-vratau — sincere in Their vows; gargāt — from Garga Muni; yadu-kula — of the Yadu dynasty; ācāryāt — from the spiritual master; gāyatram — of celibacy; vratam — the vow; āsthitau — assumed.
Translation: 
After attaining twice-born status through initiation, the Lords, sincere in Their vows, took the further vow of celibacy from Garga Muni, the spiritual master of the Yadus.
Purport: 

Both Śrīdhara Svāmī and Viśvanātha Cakravartī Ṭhākura explain the term gāyatraṁ vratam as the vow of brahmacarya, or celibacy in student life. Kṛṣṇa and Balarāma were playing the part of perfect students on the path of self-realization. Of course, in the modern, degraded age, student life has become a wild, animalistic affair filled with illicit sex and drugs.