When you commit some sin as a result of human nature, never allow this sin to bring about the slightest change in your determination to remain steadfast on the Deen and do not permit it to slacken your bond with Allah Ta’ala. Do not be deceived by the thought: ‘I am unable to remain steadfast on the Deen, hence my sinning.’ Do not think that firmness on the Deen is impossible on account of the sin committed. With this idea, do not become audacious in sin. This idea which you entertain is baseless because a sin committed as a result of the weakness in human nature is not in conflict with firmness on the Deen. Yes, persistence in sins, abstention from taubah and deliberate commission of sin are negatory of firmness (Istiqaamat).
It is quite possible that the sin committed may be the last decreed for you and thereafter such mercy may be directed to you, that you will commit no further sin.
Extract from: Ikmaalush Shiyam
There should not be in your mind any sin so grave that it prevents you from holding a good opinion of hope with Allah Ta’ala and causes you to despair of His mercy and grace. He who has recognised his Rabb knows that infront of his Rabb’s grace and mercy, his sins are insignificant.
One should not hold one’s sins in such a grave light that one loses hope in the grace and mercy of Allah Ta’ala. One should not think: “The gravity of my sin is so great that there is no forgiveness for it, and I have on account of this sin now reached a stage where I am unfit for His grace and mercy.” Such despair is the consequence of unawareness of the attributes of Allah Ta’ala.
One who has recognised his Creator and is aware of His attributes, will be acquainted with His attributes of Forgiveness and Grace. He will thus understand that in the presence of these infinite attributes, his sins are insignificant. He will always have hopes of being forgiven.
While this should be one’s attitude, one should not consider sin itself to be insignificant. If the gravity of sin is not in the heart, one will then not resort to taubah nor will there be regret and remorse.
The summary of this discussion is: Neither consider the sin in such grave light that one despairs and loses hope in forgiveness, for this too is kufr, nor regard sin so lightly that one feels no remorse and is deprived of taubah. The hope of forgiveness should be tempered with regret for having sinned, and a firm resolution should be made to refrain from disobedience in future.