The life-giving/immortal drink, Amrita, was one of the elements that resulted from the churning. The Daityas gave half of the Amrita to the Devas and departed with the remaining half. But Vishnu quickly adopted the form of a beautiful woman and approached the Daityas. So beautiful was the woman that the Demons were mesmerized and handed over the Amrita to Vishnu who served it to the Gods instead. There was only one Demon who was somewhat clever. His name was Rahu. He adopted the form of Chandra, the Moon God, and succeeded in drinking some of the Amrita. The Sun God and the Moon God noticed what was happening and reported it to Vishnu. Vishnu thereupon cut off Rahu's head.
But Rahu had drunk the Amrita, so he could not die. He prayed to Vishnu and Vishnu granted him a boon. The boon was that occasionally Rahu would be permitted to swallow up the Sun or the Moon who caused him so much misery. You can see this happening at the time of the Solar and the Lunar Eclipses. The Gods obtained the Amrita and the Demons did not. Thus, the Gods became more powerful than the Demons. They defeated the Demons and regained Heaven.
Hindu Purana References To Eclipses
Reference 01: Sage Vashishtha continued with the description of some other prominent places of pilgrimage like Jambumarg, Narmada, Amarkantak, etc. Kotirudras are believed to dwell in the vicinity of Amarkantak mountain. All together sixty crores and sixty thousand places of pilgrimage are situated all around this holy mountain. Anybody present in the vicinity of this mountain must refrain from any kind of sinful deeds. Visiting Amarkantak mountain during Solar and Lunar Eclipses is considered to be extremely auspicious.
Reference 02: Describing about the rituals connected with the worship of Lord Vishnu, Lord Mahadeva (Shiva) told Parvati: A devotee can worship Lord Vishnu by making his idol. There are some specific days which are considered to be specially auspicious for the worship of Lord Vishnu: Amavasya (Moonless Night), Saturdays, Solar and Lunar Eclipses, etc.
Reference 03: A Shradha carried out with devotion pleases the entire world including human beings, Brahma, Indra, Rudra, Ashwini Kumar, Surya, Agni, Vasugana, Marudgana, Vishwadeva, Pitragana, birds, animals, reptiles, sages and of course the dead ancestors. Moonless and Eighth Day in the darker phase of every Lunar month are considered the best days for offering oblations to the dead ancestors. Apart from these two, Third Day in the brighter phase of Vaishakh, Ninth Day in brighter phase of Kartik, Thirteenth Day in the darker phase of Bhadrapad and Amavasya of Magh are also considered excellent. During Solar and Lunar Eclipses also, oblations should be made with water and sesame.