When the soul leaves the body at night, the body experience one sixtieth part of death. The first 60 breaths less one is still in full life and after that the spirit of death comes into the body. King David was keeping himself away from any aspect of death so he woke up before the impure spirit could affect him.
After midnight the energy is shifted and the light begins to appear in the world. Waking up at that time and studying Torah connects the person with the energy of life, renewal and growth. When we join at the point of revelation of Light we support the Shechina and our prayers have better elevation.
The Zohar (Acharei Mot #217) reveals that when we wake up early to study a silver string, which is the light of Chassadim is connected to us and provide protection throughout the day by removing judgments from our path.
Additional related reading; Vayikra #379, #380