What Happens Spiritually During Sleep?(Masechet Berachot Daf ה: Perek 1 Siman 39)
(based on Berachot 1:39)
Gemara: It is stated in a baraita: Abba Binyamin said: I went to great trouble throughout my life to … [The first is that] I would pray soon before going to sleep.
Ein Ayah: [The significance of the matter is based on the following.] When a person sleeps he is steeped in physicality because the intellectual side of his desires leaves him, and only the ko’ach hemedameh (roughly, the imagination) functions. Therefore, a spirit of impurity dwells on his body to the extent that he has to remove it by washing his hands. Even though it is possible for those on a level of sheleimut (completeness) to maintain their intellectual side and reach very great attainments during sleep, as is known to have happened to many holy people who merited this, that is only from the side of the soul. However, the soul does not impact on the body during the time of sleep.
Now the difference between the way the Torah works and the way tefilla works on a person is as follows. The Torah elevates a person’s intellect and the body becomes purified by itself as a result. However, the main element of tefilla is to elevate the ko’ach hamedameh, which is the power of the body, and it is set up so that it can elevate the desire of the body for holy and lofty matters. Therefore, it is fitting that one should desire that one’s tefilla will be as chronologically close as possible to going to sleep. This is because it allows the tefilla to fix that which is missing in the body from the perspective of the nature of sleep. Since the main part of tefilla is to fix the holiness of the body, it is therefore called “temporary life” [as one’s body is of fleeting existence.]