Once a man came to prophet Muhammad (pbuh) and asked him for a way to get rid of his bad habits. He had a few problems including stealing, drugs, backbiting etc. He advised him not to lie. “Is that all” man asked, and Muhammad (pbuh) said “yes”. Within few weeks that man was almost out of most of his bad habit as when next time he burgled a house, he thought on the way that before that he used to lie to his wife that he bought that stuff and now he was determined not to lie so he went back and left the things where he burgled them from and his other bad habits vanished too due to that one advice.
But then there are three situation where in Islam you are allowed (or somewhat better) to tell a lie as the objective behind those lies is better,
1 – If you are a soldier or someone with vital information and you are captured by the enemy and they ask you to release the information and you know that by doing that you may cause damage that would have everlasting consequences.
2 – (I know this would raise some questions, knowing few people’s nature on AB). As in Islam you are allowed to marry more than one women so if your one wife asks who do you love more then you can say that it is her (even if in your heart you love the other one more) as this question either way can cause trouble and the objective of that lie is to keep your home from trouble where you may end up with a broken family and more consequences for you, your wives and children.
3 – Where the intention of your lie again is to build bridges between two people, two tribes, or even two countries that can first of all avoid hostility and then benefit people on the both sides in the long run and they can have a peaceful life.