Toras Habayis / Ch. 2 – 88
Our Sages taught that Batei Medrash raise a person from being judged negatively to being judged favorably. This is because when a person enters the beis midrash he examines his deeds, and as a result changes his way and is thereby judged favorably.
An alternate explanation is that a person is judged on Rosh Hashana according to the majority of his deeds, and if his evil deeds outweigh his good deeds, he might tip the scales to his favor by entering a beis midrash and learning Torah for a few hours. Since every minute he performs hundreds of mitzvas, within a few hours he can easily outweigh all the evil deeds he did all year long. The converse is also true, if a person sits for a few hours speaking forbidden speech he may tip the scale to the negative. So, a person should be extremely careful with his tongue, as is said in the name of Rav Hai Gaon, it should be harder for a person to move his tongue in speech than to lift a heavy beam.