John Newton’s letters are, in my opinion, some of the most edifying, biblical, and practical pastoral letters ever written (aside from inspired epistles, of course). Here’s a great section from his letter to a friend on the topic of temptation. I’ve slightly edited it to make it easier to read.
“[Satan] hates the Lord’s people, grudges them all their privileges and all their comforts; and will do what he can to upset them, because he cannot prevail against them. And though the Lord sets such bounds to Satan’s rage that he cannot pass, and limits Satan as to manner and time, God is often pleased to allow him to succeed in his rage to a considerable degree – not to gratify Satan, but to humble and prove Christians, to show Christians what is in their hearts, to make them truly sensible of their immediate and absolute dependence upon himself, and to excite them to watchfulness and prayer.”
“Though temptations, in their own nature, are grievous and dreadful, yet when, by the grace of God, they produce these effects (listed in the previous sentence), they deserve to be numbered among all things which are appointed to work together for the good of those who love God. …One gracious end that the Lord has in permitting his people to be tempted, is for the prevention of greater evils, that they may not grow proud or careless, or be ensnared by the corrupt customs of the world.”
This quote – along with Newton’s full discussion of temptation – is found in The Letters of John Newton.