The Gemara (Sota 34b) tells that when Moshe Rabbenu sent the twelve spies to see the Land of Israel, one of them – Kaleb – went to Hebron to pray at Me'arat Ha'machpela, the gravesite of the patriarchs. He prayed that he should be saved from the wicked scheme of the spies to lure the people against proceeding into the land.
This is one of the several sources that teach us of the value of visiting Kibreh Sadikim – the graves of righteous people, and praying at these sites. It is indeed customary among certain groups to pray at Kibreh Sadikim on different occasions. For example, I was told by Hacham Mordechai Attieh that there is a custom among kabbalists to visit Kibreh Sadikim every month on Ereb Rosh Hodesh. The Arizal had the practice of lying on Kibreh Sadikim in a manner whereby his soul would connect to the soul of the Sadik. And it is known that the Ben Ish Hai (Rav Yosef Haim of Baghdad, 1833-1909), during his trip to Eretz Yisrael, spent a considerable amount of time at the grave of Benayahu Ben Yehoyada.
Nevertheless, it is clear that the value of Torah learning exceeds the value of visiting Kibreh Sadikim. While praying at these sites is certainly worthwhile, this should not come at the expense of Torah learning. It is improper to take large amounts of time away from Torah study in order to pray at the grave of a Sadik. We must remember that when we learn Torah, we are, in essence, visiting Sadikim, as we are studying, and immersing ourselves in, the sacred words of the great Sages. This is a better way to connect to the Sadik than praying at his grave.
Furthermore, Hacham Ovadia Yosef would warn his students that the value of visiting the grave of a Sadik can be offset by the improper behavior, that, unfortunately, sometimes takes place at these sites. There are occasions when men and women are seen mingling inappropriately, and people are dressed immodestly, and it is far preferable for a person to forfeit the opportunity to pray at the grave of a Sadik in order to avoid such scenes.

