Here are some tips that I have found help to make dialogue more realistic and fun.
1. To make it easier to have fun and engaging dialogue, have characters that don't always agree with each other. If the people always see eye to eye, the dialogue will be dry and boring. In books and other media, often you will find that characters who are polar opposites are placed together. This helps to have some fun dialogue. While you don't want a book completely filled with bickering, it keeps things fresh to have different perspectives.
2. Don't have characters say things that the other people already know. If you are starting a story, the reader doesn't know anything, and needs to be brought up to speed, but don't use fake dialogue to do that. One way to avoid this is to bring in a new character. If you have a new character other people can explain things to that person, who really wouldn't know about it, and it isn't fake. One example of this is Twilight. Bella is new in town, so people can tell her all about Edward and the other things in school and the dialogue doesn't seem forced.
3. After writing some conversations between characters read it out loud. Does it sound like something that would actually be said? Do you know people who actually talk that way? After you have read it out loud yourself, try reading it with someone else reading the second part. This is a fun exercise to see if the conversation flows naturally. I have often found that when I read things out lout it helps me make changes so that the conversations flow better.
4. Establish subtle differences in speaking. Just like people from different places have different accents, be sure to think about that when making your characters. In a book I wrote, a character, Bendar, was very intellectual. To reflect that characteristic, I made him not use any contractions. He would say things like, "I do not know." instead of, "I don't know." In The Wheel of Time Jordan and Sanderson do an excellent job making characters from different regions have very unique voices. Some characters use the made up curses like "Burn me!" And the people around react in a variety of ways to the foul language. There are also some people who use more formal speech, and others who grew up in the desert who greet each other by talking about seeking shade. It really is masterfully done in this series.
5. Think about how people would really react. When I wrote the first draft of my first novel, I had my brother read over it. He read the beginning where Garin and Fenn almost kiss. In the original draft, she was a little sad, but didn't get upset. He wrote back and said something like, "I don't know any woman who would react that way to being rejected." When I thought about the sequence the way it was written, I had to agree. It wasn't a realistic reaction. I revamped the dialogue and action to reflect how I think her character would react.
6. Don't rely completely on dialogue to drive the plot. This is a person preference more than anything. I like fun dialogue, but if it is the primary way of driving the plot all the time it gets old quickly. A great book series that has a balance between description, dialogue and action is Ranger's Apprentice. John Flanagan is fantastic at keeping that balance, and it makes reading a pleasure.
Dialogue is so important in a book. Making sure you don't have everyone sound exactly like yourself is challenging at first, but if you keep the characters in mind it will help to make sure the dialogue flows. Consciously put in effort to put these points into practice and you will find other strategies that work for you to improve the dialogue in your writing.