If your expectations are reasonable then don't feel bad about punishing. If you have told a pupil what you expect and then warned them once (or twice as you say) then they can expect the detention. The thing to know about sanctions is that if it's done correctly then you will give fewer and fewer sanctions with time but this only happens if you are consistent and the punishment bothers the pupil enough. If a pupil know that they will get caught for misbehaving and does not want the punishment then they will not misbehave. Keep doing what you're doing, but if you're still giving out tonnes of detentions out months down the line then chances are you're not being consistent enough or the punishment does not sting enough. Being consistent often means handing out a lot of sanctions of first and then slowly the kids get the message. Inconsistensy often follows from a reluctance to give out too many sanctions but ironically these teachers give out more detentions in the long run as they experience poor behaviour week after week after week.