Perpetual check, trying for either a triple repitition of position or the 50 moves (with no pawn move or capure) draw is a very integral part of the game and a very important resource to look for when in a losing position otherwise.
The way to avoid it is to keep your position as secure as possible; though that is sometimes easier said than done. Also, if you must open up your position, try and make sure you will eventually have a way to stop it and still continue your own attacks.
How do you avoid draws with people who continuously check you the same way so that they can avoid losing?