The number 7, symbol of perfection
In Egypt
In Ancient Egypt, the numer seven was considered a symbol of perfection and efficiency. In many myths, the number 7 is used for both good and bad events.
Then Ra repented. His fierce anger passed away, and he sought to save the remnant of mankind. He sent messengers, who ran swifter than the storm wind, unto Elephantine, so that they might obtain speedily many plants of virtue. These they brought back, and they were well ground and steeped with barley in vessels filled with the blood of mankind. So was beer made and seven thousand jars were filled with it.
In the seventh hour-division sits Osiris, divine judge of the dead.
You can find these texts and more here.
Wikipedia lists a lot of occurences of the number 7.
In judeo-christian myths
This idea of perfection and completeness is found in judeo-christian beliefs as well :
Roy Alan Anderson in Unfolding the Revelationi
notices that to the Hebrew:
6 represented unrest,
7 perfection and
8 victory.
When the number is repeated then it signifies an eternal quality. For example 666 would signify
eternal unrest.
Note that the repetition is 3 times - three being the number of holiness.
The number 7 is extremely frequent in Christianity - the Book Of Revelations mentions 7 churches, 7 trumpets, 7 bowls, 7 seals and 7 spirits. This tends to confirm that 7 is used to make a complete set.
In Greece and the origin of the 7 in Christianity
While the reason about the origin of the number 7 in Egypt is hard to know, there are sources trying to explain where the 7 came to mean "perfection" in christian myths.
The Greeks considered 6 to be a perfect number, because of its divisibility. A sixth is one, or unity. A third is two, a half is 3, etc. The foot is also a sixth of the human size, so 6 represented the human. Finally, it is the sum of its divisers. More here.
Pope Gregory I found similar properties in the number 7, aswell as considering it representing eternity according to Dialectics and Humanism, vol. VII, no. 2. One of the reasons given for his fascination with the number is its presence in Antique history : the Seven Wonders, the seven stages of man, the seven planets...
The number Seven always represented a complete set.
This changed a lot - While Saint Augustine wrote that the world had been created in 6 days, this changed to 7 in the Middle Ages.
The reason behind the Seven Sages of Greece seems thus not to be linked to mythology or religion.