The Prophet ﷺ said, "If one of you, when he comes to his wife, says, 'In the name of Allah. Allah, keep Satan away from us, and keep Satan away from what You bestow upon us,' and then a child is decreed for them from that union, no devil will ever harm that child."In another wording, "If one of them, when he intends to come to his wife..."
قال النبي ﷺ: أما لو أن أحدكم يقول حين يأتي أهله: بسم الله، اللهم جنبني الشيطان، وجنب الشيطان ما رزقتنا. ثم قدر بينهما في ذلك أو قضي ولد لم يضره شيطان أبدا. وفي لفظ: لو أن أحدهم إذا أراد أن يأتي أهله…
Bukhari related it in the Book of Marriage (5165), and Muslim in the Book of Marriage (1434: 116). Both came through the route of Mansur, from Salim bin Abu Jaad, from Kurayb, from Ibn Abbas, who mentioned it. The wording given is Bukhari's. The second wording is Muslim's. The second wording indicates that this saying is to be uttered before beginning intercourse.