Q. Why do we say shalom aleichem (in kiddush levana) three times?
A. Most Poskim mention greeting Shalom Aleichem three times, as cited in Tur from Maseches Sofrim. Some see the strength of chazaka (usually a strong, established and reliable act that has been repeated three times) reflected in that number (Likutey Mahariach – Leil Shabbos, Otzar Minhagei Yeshurun p.236.)
Another reason echoes a Medresh Tanchuma - Toldos. It portraits Esav crying and shedding three tears when he lost the brochos to Yaakov. To protect ourselves from the kitrug and indictment emanating from those three tears we recite Sholom Aleichem three times, since the Gimatrya of Esav (376) has the same value as Sholom.(Ben Ish Chai Vayikra 28)
Bnay Yisoschor (Rosh Chodesh 4) quoting the Arizal based on the verse (Tehilim 119: 165) “Shalom Rav “ that establishes the difference between plural and many. Yamim (plural of days) is shnaim or two, while Rabim or many is three, (see Kesubos 75a.) Therefore Shalom Rav is three times shalom.
However, others direct to repeat it only twice. Since we previously mentioned “David Chai Vekayom,” which is also an allusion to the Melech Hamoshiach, who will be preceded by Eliahu Hanavi. According to the Pesikta Derav Kahana, the prophet will stand on the mountains surrounding Jerusalem and proclaim and repeat; Shalom has come to the world (Sidur Iyun Tefila p.542.) Yet a third opinion avers that some (Sephardic) communities (London and Amsterdam) would say it only once (Sidur Hageonim Vehamekuvalim p. 71.)
As mentioned in the previous question, Horav Shlomo Miller’s Shlit”a opinion is that a fundamental basis for greeting Shalom Aleichem is the receiving of the brocho of Sholom as an answer. As in Hatavat Chalom (the act done to mend and soothe bad dreams) a threefold blessing is accustomed.
Rabbi A. Bartfeld as revised by Horav Shlomo Miller Shlit”a