I have much more complete records for the women, so any men's marks I have will be out of date.
Longest match, time:
Women: Vicki Nelson-Dunbar d. Jean Hepner 6-4 7-6(11) in the 1st round at Richmond in 1984. The match lasted 6 hours, 31 minutes. The tiebreak lasted 1 hour 47 minutes. One point in the tiebreak lasted 29 minutes (643 shots).
Men- there was a Davis Cup match involving John McEnroe in the mid-80's (vs either Wilander or Becker) that lasted slightly longer. I'm sure someone will have more details.
Longest sets (games):
Women- 36, Billie Jean King d. Christine Truman 6-4 19-17, 1963 Wightman Cup
Doubles- 64, Nancy Richey and Carole Graebner d. Justina Bricka and Carol Hanks 31-33, 6-1 6-4, South Orange NJ, 1964
Men- the mark I have is 66- Vic Sexias d. Bill Bowrey 32-24, 6-4 10-8, Pennsylvania Chps., July 1966
Doubles- 96- Dick Dell and Dick Leach d. Tommy Mozur and Lenny Schloss 3-6, 49-47, 22-20, Newport, August 1967.
On the other end of the spectrum, J.E.Harper d. J.Sandford 6-0 6-0 in 18 minutes
at Sutton on April 9, 1946. Harper lost only 1 point on his 32nd birthday (which has to be the best birthday performance ever.