How to abstain from sex according in the Bible?
Don't do it.
How to abstain from stealing. Don't do it.
How to abstain from being greedy. Don't do it.
The truth is it all depends on how much you love the Lord, for we are to love the Lord more than doing sin.
And there is no struggling with sin, only not submitting to the Spirit, for a Spirit led life has crucified the flesh with the affections and lusts, so their desire is to do good, and do not care about evil.
Which the Bible says that some have a form of godliness, but deny the power thereof, and are lovers of pleasures more than lovers of God.
So they like to sin, so they do not allow the Spirit to lead them, although they will say they have the Spirit, but many are relaxed in how they are supposed to conduct themselves, and think they are alright.
But we should never act holier than thou, and sex appears to be one of the biggest sins that tempts many people that are not married, or married and cheat.
It appears that the love of money is the biggest sin that tempts people, for people would rather have a lot of money than sex.
Which the Bible says the love of money is the root of all evil, not the love of sex is the root of all evil.
If people were on the same level money wise, and material wise, and prestige wise, a lot of people that are together today in relationships would not be together, for it is money, and material things, and prestige, that is the biggest determining factor in why people are together.
Because the world, and the flesh, is based on self exaltation, which sex does not exalt them like money, and material things, and prestige.