We should keep death always in mind.
http://measurelessmind.ca/maranasanna.html
The recollection of death is explained in AN 6.20 Dutiyamaraṇassati Sutta:
Here, monks, as day departs and night sets in, a monk reflects: ‘The [possible] causes of my death are many. A snake, scorpion, or centipede may bite me. My death could occur because of that. That would be an obstacle for me. I may stumble and fall down; the food I have eaten may trouble me; my bile may be disturbed; my phlegm may be disturbed; my [internal] winds may be disturbed. My death could occur because of that. That would be an obstacle for me.’
Then, monks, a monk should reflect: ‘Are there any worthless, unskillful qualities that I have not given up that would be an obstacle for me if I were to die tonight?’
If, monks, upon reflecting in this way, the monk knows that ‘There are worthless, unskillful qualities that I have not given up that would be an obstacle for me if I were to die tonight,’ then he should engender extra desire, effort, diligence, energy, zeal, mindfulness, and full awareness for the abandoning of those very same worthless, unskillful qualities.
Just as, monks, if someone’s turban or head was burning, they would engender extra desire, effort, diligence, energy, zeal, mindfulness, and full awareness to extinguish the fire; in the same way, the monk should engender extra desire, effort, diligence, energy, zeal, mindfulness, and full awareness for the abandoning of those very same worthless, unskillful qualities.
But if, monks, upon reflecting in this way, the monk knows that ‘There are no worthless, unskillful qualities that I have not given up which would be an obstacle for me if I were to die in the night,’ then he should abide in joy and gladness, training day and night in skillful qualities.
The benefits of the recognition of death are described in AN 7.49 DutiyasaññÄ� Sutta:
‘The recognition of death, monks, when developed and cultivated, is of great fruit and benefit; it merges with the death-free, has the death-free as its end.’ Thus it was said. In reference to what was it said?
Monks, when a monk’s mind frequently remains acquainted with the recognition of death, his mind shrinks away from, recoils, pulls back, and is not drawn toward longing for life, and either equanimity or dislike are established. Monks, just as a cock’s feather or a piece of tendon, when thrown into a fire, shrinks away, recoils, pulls back, and is not drawn in; in the same way, when a monk’s mind frequently remains acquainted with the recognition of death, his mind shrinks away from, recoils, pulls back, and is not drawn toward longing for life, and either equanimity or dislike are established.
If, monks, when a monk’s mind frequently remains acquainted with the recognition of death, his mind inclines toward longing for life, or if admiration continues, then he should know, ‘I have not developed the recognition of death, there is no stepwise distinction in me, I have not obtained the strength of development.’ In that way he is fully aware there. But if, monks, when a monk’s mind frequently remains acquainted with the recognition of death, his mind shrinks away from, recoils, pulls back, and is not drawn toward longing for life, and either equanimity or dislike are established, then he should know, ‘I have developed the recognition of death, there is stepwise distinction in me, I have obtained the strength of development.’ In that way he is fully aware there.
‘The recognition of death, monks, when developed and cultivated, is of great fruit and benefit; it merges with the death-free, has the death-free as its end.’ Thus it was said. And in reference to this it was said.
Sustained, dedicated practice of the recognition of death will gradually create the optimal conditions for the arising of all seven factors of awakening. SN 46.68 Maraṇa Sutta (abridged):
Here monks, a monk develops the awakening factor of mindfulness accompanied by the recognition of death, dependent upon seclusion, dispassion, and cessation, resulting in letting go. He develops the awakening factor of dhamma-investigation accompanied by the recognition of death, dependent upon seclusion, dispassion, and cessation, resulting in letting go. He develops the awakening factor of energy accompanied by the recognition of death, dependent upon seclusion, dispassion, and cessation, resulting in letting go. He develops the awakening factor of joy accompanied by the recognition of death, dependent upon seclusion, dispassion, and cessation, resulting in letting go. He develops the awakening factor of tranquility accompanied by the recognition of death, dependent upon seclusion, dispassion, and cessation, resulting in letting go. He develops the awakening factor of meditative composure accompanied by the recognition of death, dependent upon seclusion, dispassion, and cessation, resulting in letting go. He develops the awakening factor of equanimity accompanied by the recognition of death, dependent upon seclusion, dispassion, and cessation, resulting in letting go.
It is in this way that the recognition of death is developed and cultivated so that it is of great fruit and benefit. It is in this way that the recognition of death is developed and cultivated so that one of two fruits is to be expected: either final gnosis in this very life or, if there is a residue of clinging, the state of nonreturning. It is in this way that the recognition of death is developed and cultivated so that it leads to great good. It is in this way that the recognition of death is developed and cultivated so that it leads to great security from bondage. It is in this way that the recognition of death is developed and cultivated so that it leads to a great sense of urgency. It is in this way that the recognition of death is developed and cultivated so that it leads to dwelling in great comfort.