On that fateful fourth day of his marriage his young wife did not allow him to sleep. She laid all the ornaments and lots of gold and silver coins in a big heap at the entrance of her husband's palatial room and lighted infinite numbers of lamps all over the place. After all these, she went on telling stories and singing songs so that her husband is not able to sleep.
When Yam, the god of Death arrived there appearing in form of a Serpent his eyes got blinded by the dazzle of those brilliant lights and he could not enter the Prince's chamber. So he climbed on top of the heap of the ornaments and coins and sat there whole night listening to the melodious songs. In the morning he quietly went away.
Thus the young wife saved her husband from the clutches of death. Since then this day of Dhanteras came to be known as the day of "Yamadeepdaan" and lamps are kept burning throughout the night in remembering Yam, the god of Death.
Thirteen lamps made of wheat flour and lit with oil are placed outside the house, facing southwards (direction of Lord Yama), in the evening. A lamp is never kept facing southwards except on this day. Then, reciting the following mantra one should offer obeisance: "I offer these thirteen lamps to the son (Lord Yama) of the Sun deity (Surya), so that He liberates me from the clutches of death and bestows His blessings."