Let who's speaking be reflected in action sometimes. Use dialogue tags to eliminate confusion of who is saying what, or slip in a name every now and again, sparingly. So it doesn't come across like, "What do you think, Joe?" "I think you're full of shit, Bob."
People talk clipped sometimes so, for example, instead of saying, "Are you talking to me?" DeNiro's taxi driver said, "You talkin' to me?" They use contractions, so do that if appropriate to the character. Create unique speech patterns, little quirks, whatever, to help delineate your characters.
If your dialogue is going to come across as real, you have to know your characters, really know them. That's paramount, I think. So, I envision the scene, see my characters--I know exactly what they're doing, feeling, and I write what they say. Then I read the scene aloud. Does it sound natural? Is it appropriate for the scene?
EtA: Already mentioned. A really good idea, I think.
Another really important consideration is, does the dialogue DO something, move the story along in some way? Sometimes you have to drop the boring little stuff people really say, remembering that you're . . . not transcribing. You always have to be cognizant of story.
So I read aloud and often edit right after that. Or rewrite. Cut. Edit some more and read it aloud again, blah blah, until I'm satisfied. Sort of. I tend to return to key dialogue scenes after writing more, to double-check that everything still makes sense and fits together smoothly. An example from my NaNo WIP:
“When did he do it, do you know?”
“I think before Halloween. Maybe way before--no, not way ‘cause lots of leaves was on the ground. What’re we gonna do, Mike?”
“I don’t know.”
“Should we tell Mom?
“We ain’t got no proof, Albert. We gotta get proof or nobody’ll believe us and then he’ll know and that’ll be it.”