Sukracharya was the preceptor of Asuras (demons). The Asura king Vrishaparva greatly respected Sukracharya as he knew the secret of Mritasanjibani, a drug that brings the dead back to life. Devayani was Sukracharya's only daughter and spoiled by her father's indulgence.
One morning, Sharmishtha, the Asura princess, daughter of Vrishaparva, came to Sukracharya's hermitage with her friends. She asked Sukracharya to allow Devayani to accompany them for a bath in a nearby lake. Sukracharya agreed. They soon reached the lake and left their clothes on the bank to go into the water. Suddenly a storm blew up and scattered their clothes. The girls hurriedly came out of the lake and got dressed. It so happened that the princess Sharmishtha, by mistake, clad herself in Devayani's clothes. Angered by this, Devayani insulted Sharmishtha, the Asura princess. Argument began and Sharmishtha pushed Devayani into a dry well and left Devayani in the well.
It so happened that Yayati, the king of a nearby state, came hunting in the forest and was looking for water to drink. When he came near the well he was surprised to find Devayani lying at the bottom. Devayani introduced herself and said that she fell into the well. She then requested the king to pull her out. Yayati helped her out. Devayani demanded that Yayati marry her as he has held her by the right hand. Yayati was alarmed and turned down her request on the ground that he belonged to lower Khatriya (or warrior) caste, and Devayani was a Brahmin (priestly) maid. Yayati then left and Devayani continued to sit under a tree.
When she did not return, Sukracharya set out in search of her. He found Devayani under a tree, her eyes filled with tears of anger and grief. When Sukracharya inquired, Devayani told her father every thing, carefully hiding her own faults. She refused to return to the kingdom of Vrishaparva as she was badly insulted by the Asura princess, Sharmishtha. Failing to change her mind, Sukracharya returned to Vrishaparva and announced that he was leaving the Asura kingdom because of his daughter Devayani's unhappy conflict with princess Sharmishtha. Vrishaparva begged Sukracharya to stay. Sukracharya left the decision with his daughter Devayani.
Vrishaparva wasted no time and went to Devayani taking his daughter Sharmishtha along. He begged forgiveness for his daughter. Devayani agreed to return on one condition that Sharmishtha be her handmaiden for the rest of her life. Sharmishtha agreed for the sake of her father, the king. Devayani was pacified and returned to her father's hermitage. But Devayani was vindictive and humiliated Sharmishtha by asking to massage her legs and run errands.
One day, king Yayati passed that way. Devayani introduced Sharmishtha as her maid and reminded Yayati that he should marry her. Yayati repeated that he could not marry a Brahmin maid. Devayani then took Yayati to her father. Sukrachaya gave his blessing on their marriage. They were soon married and led a happy life. Devayani had two sons.
Sharmishtha continued to stay as Devayani's handmaid. Yayati made a palace for Shramishtha at the request of Devayani. One day Sharmishtha secretly met Yayati and told him what happened between her and Devayani. Yayati was sympathetic. Sharmishtha begged Yayati to take her as the second wife. Yayati agreed and married her but without the knowledge of Devayani. Sharmishtha had three sons.
One day, Devayani met the three sons of Sharmishtha. She asked the boys the name of their father. They pointed to Yayati. Devayani was shocked. She felt deceived and ran to her father's hermitage. Sukracharya was enraged and cursed Yayati with premature old age. Yayati begged for forgiveness. Sukracharya and Devayani felt sorry for him. Sukracharya then said, "I cannot take back my curse, but if any of your sons is ready to exchange his youth for your old age, you will be young again as long as you wish."
Yayati, now an old man, quickly returned to his kingdom and called for his eldest son. "My dutiful son, take my old age and give me your youth, at least for a while, until I am ready to embrace my old age." The eldest son turned down his father's request and so also the next three older brothers. Then came the youngest, Puru. He agreed and immediately turned old. Yayati rushed out as a young man to enjoy his life. After years spent in vain effort to quench his desires by indulgence, Yayati finally came into senses. He returned to Puru and said, "Dear son, sensual desire is never quenched by indulgence any more than fire is extinguished by pouring oil on it. Take back your youth and rule the kingdom wisely and well."
Yayati then returned to the forest and spent the rest of his days in austerities, meditating upon Brahman, the ultimate reality. In due course, he attained heaven.