"Jacob went out from Beer Sheva, and went toward Haran. He came to a place and spent the night there, since the sun had set; he took of the stones of that place, and put them under his head, and lay down in that place." (Gen. 28:10-11)
The whole paragraph can be seen to allude to man as a species. The Zohar (I:147) understands the words "and Jacob went out" as describing the soul when it first departs from the higher [spiritual] world and takes up residence within a body. This body is called "Jacob" on account of the Evil Inclination, which constantly tags along at our heels, so to speak.
The Hebrew word for "Jacob" is "Yaakov", containing the letters used to spell the word for "heel", "akeiv".
The words "from Beer Sheva" [literally "the well of the oath"], is a reference to the source the souls come from which is known as "the well of living waters". The word "sheva" refers to the oath [in Hebrew, shevua"] G‑d makes every soul swear when it departs from heaven that it will not violate Torah laws while inside a human being. (Compare Niddah 30)
The Evil inclination enters man from the moment he leaves his mother's womb….
The words "and went towards Haran" are an allusion to the statement of our Sages that the Evil inclination enters man from the moment he leaves his mother's womb. (Sanhedrin 91 This is based on the phrase "sin crouches at the entrance". (Gen. 4:7)
The word "Haran" shares the root letters of the Hebrew word for "pregnancy", "heriyone".
The words "he came to a place" are a reminder that man has to invoke
G‑d's help through prayer, G‑d being the "site of the universe".
When the Torah continues, "…and spent the night there, since the sun had set", this is a reminder that man has to conduct himself properly all his life until he dies, i.e. "until his sun sets". This is why our Sages said, "Do not be certain of your righteousness until the day you die." (Avot 2:4)
The Torah continues, "He took from the stones of that site." This is analogous to the statement by Rabbi Shimon ben Lakish that a person should constantly strive to provoke his Good Inclination, i.e. criticize himself by struggling against the Evil Inclination. (Berachot 5) Should he fail to overcome his Evil Inclination, he should busy himself with Torah study, as suggested by David. (Psalms 4:5)
If one fails to overcome his Evil Inclination, he should think of the day when he is going to die….
When the Torah refers to "from the stones of that place", this refers to the building blocks by means of which the world is built, i.e. Torah.
These words may also relate to the stones used to kill the Evil Inclination and its representatives. This is what the Talmud means when we are told that Torah saves one from the Evil Inclination not only when one is actively engaged in its study, but even when one is temporarily not busy with Torah. (Sotah 21)
The Torah goes on, "…and put them under his head", to allude to the statement of Rabbi Shimon ben Lakish that when one fails to vanquish the Evil Inclination one should resort to reciting the Bedtime Shema, seeing that David speaks of "on your bed". (Psalms 4:5)
The words "[he] lay down in that place", allude to the final statement on the subject by Rabbi Shimon ben Lakish, that if one fails to overcome his Evil Inclination, he should think of the day when he is going to die. This is why the Torah preferred to use the word "lay down" to "slept", since that word implies a lying down from which one may not get up again. Having employed all those means to try and overcome one's Evil Inclination, a person may be confident of success.
[Selected with permission from the five-volume English edition of "Ohr HaChaim: the Torah Commentary of Rabbi Chaim Ben Attar" by Eliyahu Munk]