151:6 if a person wants to keep himself from this sin, he should guard his mouth from vulgar speech, lies, slander, gossip and foolishness. Similarly, he should keep his ears from hearing such things. One should also be careful to fulfill his oaths and not to worry too much. One should also be careful not to have bad thoughts. Before going to sleep, he should occupy himself with Torah study or recite the first four Psalms, and not sleep in a room by himself.
151:7 Ways to rectify failures in this area are written in the book “Yesod Yoseif.” Among these: serving as sandek to have children circumcised on his lap, especially for poor people; donating much charity to the poor; keeping Shabbos properly and lighting many candles; honoring those who study Torah; praying with great sincerity and intention; pursuing the trait of humilty; ignoring and forgiving those who curse him; performing mitzvos with speed and vigor until they are completed, especially preparing the matzah for Passover; raising his children to study Torah and to have proper awe of G-d; adopting an orphan and raising him as his own; helping a girl to get married; being called to the Torah at least once a month, reciting the brachos out loud, and looking in the Torah and reading quietly along with the reader; being among the first ten to arrive in shul; getting up at midnight to recite “Tikkun Chatzos” with great sincerity – if he is not able to get up at midnight, he should recite “Tikkun Chatzos” later; loving and pursuing peace.