The story of Yayati comes in the Book Nine, 19th Chapter of Bhagavata Purana.
Yayati was a Puranic king and the son of King Nahusha and his wife Viraja. He was one of the ancestors of Pandavas. He had five brothers: Yati, Samyati, Ayati, Viyati and Kriti.
Devayani was the daughter of Sage Shukracharya, the priest of Asuras (the demons), she had been cursed by sage Kacha that she would not marry another Brahmana. Sage Shukra was living in his palace. At that time the Asura king was Vrushaparva, whose daughter Sharmishta was close friend of Devayani.
One day, Devayani and Sharmishtha along with the hoard of servants were amusing themselves in a park. It so happened that Devyani fell into a dry well due to mis-understanding between Devyani and Sharmista. However, Yayati rescued her from a dry well. Yayati was instantly attracted to Devyani and pulled her up and professed his love for her.
Yayati said, “Unless your father gives you to me in marriage, I will not accept you as my wife.” Shukracharya gave in to his daughter’s request and agreed to give her away in marriage to King Yayati. As dowry, he gave away Sharmishtha as a maid to Devyani as a punishment for pushing her into the well.
Sharmishtha was given a place to live in a shaded glade called Ashok Vatika. One day Yayati happened to pass by Ashok Vatika where Sharmishtha lived. Seeing him, Sharmishtha confessed that she too was in love with the king and wanted him to marry her. She told him that she belonged to a royal family, and Yayati could marry her. Yayati agreed and they wed in secret. They continued to meet and hid the fact from Devayani that they were married. Yayati had two sons from Devayani, Yadu and Yavana. Yayati also had three sons from Sharmishtha, Druhyu, Anu and Puru.
When Devayani came to know about the relationship of Yayati and Sharmishtha and their three sons, she felt shocked and betrayed. Devayani went away to her father Shukracharya, who displeased with the king. Shukracharya cursed that Yayti would lose his youth, and become an impotent old man immediately.
As soon as Shukracharya uttered his curse, Yayati became an old man. Shukracharya also said that his curse once uttered, could not be taken back, and added that the only concession he could give was that if Yayati wanted, he could give his old age to someone, and take his youth from him. Yayati was relieved at the reprieve he was given, and was confident that his sons would willingly exchange their youth with him. Yayati requested all his five sons from Devyani and Sharmishtha one by one to give their youth to him to enjoy the worldly happiness. All the sons, except Puru rejected his demand. So, Yayati took the youth of Puru. Later on, Puru became the successor of King Yayati.
Yayati enjoyed the sensual pleasures for a “thousand years” and later realized the futility and said, “Know this for certain, … not all the food, wealth and women of the world can appease the lust of a single man of uncontrolled senses. Craving for sense-pleasures is not removed but aggravated by indulgence even as ghee poured into fire increases it….One who aspires for peace and happiness should instantly renounce craving and seek that which neither grows old, nor ceases even when the body ages.” Yayati then gave back the youth to Puru, receiving his old age in return. He renounced the world, and retired into a forest and according to the story, attained swarga through his spiritual practices.
A Story of Yayati – Mythology Stories