In Christianity, especially the Eastern Orthodox and Roman Catholic traditions, a vigil is often held when someone is gravely ill or dying. Prayers are said and votives are often made. Vigils extend from eventual death to burial, ritualistically to pray for a loved one, but more practically so they are never alone.
In the Middle Ages, a squire on the night before his knighting ceremony was expected to take a cleansing bath, fast, make confession, and then hold an all-night vigil of prayer to God in the chapel, readying himself for his life as a knight. He would dress in white, which was the symbol for purity.
When a Jew dies, a watch is kept over the body and Tehillim are recited constantly, until the burial service.