1977. Harry Burns (Billy Crystal) and Sally Albright (Meg Ryan) share a long car ride from the University of Chicago to their new, post-graduation lives in NYC. En route, they discuss whether a man and a woman can be friends, without sex getting in the way. Concluding that they cannot be friends, they part ways upon their arrival.
1982. Sally and Harry share a plane flight. Sally is now in a relationship with Joe (Steven Ford), while Harry is about to get married to Helen (Harley Kozak). Once again, Harry explains why men and women can't be friends, even if they're in relationships with other people. They part ways again once the flight is over.
1987. Sally tells her friends, Marie (Carrie Fisher) and Alice (Lisa Jane Persky), that she and Joe broke up; while Harry tells his friend Jess (Bruno Kirby) that Helen has left him. Harry and Sally meet again in a bookstore, and over dinner discuss their lives. Harry is surprised to realize he has a "woman friend", and they go on to have late-night phone conversations (about Casablanca, for example, and whether Ingrid Bergman should have stayed with Humphry Bogart at the end of the movie), visit museums, and so on. Sally feels uncomfortable telling Harry she is dating again, but he encourages her to do so, and tells her about his dates. They discuss his relationships with women, and Sally fakes an orgasm at a diner, to prove to him that it can be done, after which another customer (director Rob Reiner's mom, Estelle Reiner) orders "what she's having".
Over dinner, Harry tries to match Sally to Jesse, while Sally tries to match Harry to Marie. Marie and Jesse end up together.
Four months later, Harry and Sally are shopping for Jesse and Marie's upcoming wedding when they bump into Harry's ex-wife. Later, we learn that Sally is now dating Julian (Franc Luz), while Harry is dating Emily (Tracy Reiner), but when Sally learns that her ex-boyfriend, Joe, is getting married, she calls Harry in the middle of the night. He comes over to comfort her, and they end up having sex.
Not sure how to handle the situation, Harry and Sally grow apart. At Jesse and Marie's wedding they have a fight, but later, at a New Year's Eve party, Harry comes over and tells Sally that he loves her. They kiss and later get married.