1,054. Intentional Arousal
151:2 It is prohibited for a man to purposely induce an erection or to arouse himself by thinking about a woman. If he has such thoughts, he should replace them with Torah thoughts. This is because sexual thoughts only preoccupy one whose heart is devoid of wisdom. A man should be very careful not to sleep in a position that is likely to induce an erection; on one's side is the most advisable position. Two bachelors may not share a bed, one may not watch animals mate, and one may not ride on an animal without a saddle.
151:3 When urinating, a man may not hold the place of his circumcision. If he is married, his wife is in town with him, and she is ritually clean, then it is permitted. Since the possibility of marital relations exists, a man is not as prone to improper thoughts. Nevertheless, it is good for pious people to act stringently in this matter.
YOU MAY BE INTERESTED IN: Avoiding and atoning for the wasteful emission of seed.