It should be clear that life is a gift from Allah; therefore, we must cherish every second of it and utilize it for seeking the pleasure of Allah, our Creator Who is All-Wise and All-Knowing. Since Allah alone knows what is best for us, we are to leave such decisions to Him and surrender to His will. That is because, how can we be so sure in our heart that it is good for us to die then and there, and not some other time? Who knows what other works have been destined for us by our Creator?
In any case, one can say the du`aa’ of the Prophet (peace and blessings be upon him): “Allahumma ahyini ma kanati al-hayatu khayran li wa tawaffani ma kanat al-wafatu khayran li (O Allah, grant me life if life is good for me, and grant me death if death is good for me).
Having said this, however, we must add a further note: There is nothing wrong— and, nay, it is indeed most meritorious —for a believer to pray to Allah to make death visit when he is in the best act or deed of his life. One of the prayers of the salaf as-Salih (righteous predecessors) therefore was, “Allahumma ij`al khayra `amali khawatimahu, wa ij`al khayra yawmi yawma alqaka! (O Allah seal my life (of this world) with the most excellent and the best work of mine, and grant that the best day of my life be the day I look at Your face!)”