Thomas Brooks wrote that one of Satan's devices against believers is "making the soul bold to venture upon the occasions of sin". Brooks gives various considerations as remedies:
A. Certain scriptures expressly command us to avoid occasions of sin and the least appearance of evil
B. There is no conquest over sin unless the soul turns from the occasions of sin
C. Saints now glorified have turned from the occasions of sin as from hell itself
D. To avoid the occasions of sin is an evidence of grace
John Preston also emphasised that avoiding occasions of sin is a mark of grace. Just like we should never put an occasion to fall in the way of anyone else we should avoid it for ourselves (Romans 14:13). Perhaps the classic case of avoiding occasions of sin is Joseph in the house of Potiphar not willing to be in the presence of Potiphar's wife much less listen to her words. Jonathan Edwards has a powerful sermon on this. One of the things that he says is "we ought to treat God as a dear friend. We ought to act towards him, as those that have a sincere love and unfeigned regard to him; and so ought to watch and be careful against all occasions of that which is contrary to his honour and glory".
But this post is entitled occasions of grace. And it is Edwards who lends the instruction on this also.
endeavour to promote spiritual appetites by laying yourself in the way of allurement. We are to avoid being in the way of temptation with respect to our carnal appetites. Job made a covenant with his eyes (see Job 31:1), but we ought to take all opportunities to lay ourselves in the way of enticement with respect to our gracious inclinations. Thus, you should be often with God in prayer, and then you will be in the way of having your heart drawn forth to Him...[He then speaks about the Lord's Supper]…Live in the practice of these inclinations. If you long after God and Jesus Christ, then often go to God and Christ and converse with them.This is very helpful. You can have the double spiritual effect of helping to reduce your occasions to temptation and sin by increasing your occasions to grace. The sermon on Song of Solomon 5:1 is difficult to come by online but is reprinted in various books. I took these words from a daily devotional drawn from Edwards. Below is the manuscript of Edwards' sermon.