Shah Hakeem Muhammad Akhtar Ra ha prescribed that if someone find it very difficult to leave any sinful act, he should keep company with a Shaykh who is Rabbani (Allah-wala / Godly). If he spends Forty Days under his guidance and wardenship, God willing, for that person it will be made very easy to leave the sins.
Shaykh Ashraf Ali Thanvi Ra gave analogy that just like as the egg of a hen when remains under the wings of the mother hen for twenty one days, it produce life inside the egg, not only that, the chic also comes out to the outside world by breaking the shell of the egg; similarly if a person stays for Forty days with his Murshed, he will attain the renewed life of faith (imani zindagi) and deep relationship with God (nisbat ma’Allah).
Manazel e Suluk