christian, you cannot keep the devil "away", but when he comes, God will send him away as quickly as he came if you do this one thing:
James 4:7
Submit yourselves therefore to God. Resist the devil, and he will flee from you. Draw nigh to God, and he will draw nigh to you.
That means, if you are being tempted (wether it to lie, or lust etc) resist that temptation, by turning your mind to God.
You can say, God i`m turning to you in this moment of temptation, and obeying you by resisting thinking or doing what I know is wrong...and the result
always is, God then comes close to you and satan has to flee.
If you are afraid or in danger, you do the same thing, think on God, and He will come to you and give you peace.
Joh 14:27
Peace I leave with you, my peace I give unto you: not as the world giveth, give I unto you. Let not your heart be troubled, neither let it be afraid.
Psa 34:7
The angel of the LORD encampeth round about them that fear him, and delivereth them.
If you are a child of God, you have an angel of God that surrounds you at all times, that should make you feel mighty safe