Officially, the record goes to "The Cure for Insomnia" by John Henry Timmis IV, which premiered in Chicago in 1987 with a running time of 5220 minutes, or exactly 87 hours. I haven't seen the movie myself, but apparently it is mostly a poet reading from a 4000+ page poem, occasionally intercut with stock footage, so I don't know if this would count as a "movie" by your definition.
The longest narrative film (that is, a film with a coherent story and characters) is Rainer Fassbinder's 939 minute (15 and a half hour) "Berlin Alexanderplatz." However, it was broken down into segments and originally shown as a German TV series, so again I don't know if it fits the criteria of being a "movie." It has been shown in its entirety at several film festivals, though.
There was a version of "War and Peace" made in Russian in 1968 by Sergei Bondarchuk which runs close to 6 hours 45 minutes. It holds the Guinness record for being the longest film shown in its entirety on television.
And, for the record, the longest Hollywood movie ever made is Michael Cimino's "Heaven's Gate" which originally had a running time of 5 hours 25 minutes, but was subsequently cut to 3 1/2, and then 2 1/2 hours for its theatrical releases. The longest Hollywood movie to ever be shown in its entirety is "Cleopatra" with several versions ranging from 3 hours 12 minutes, to 4 hours, to 5 hours 20 minutes (the director's cut). "Gone with the Wind"'s theatrical release version beats out the shortest run time of "Cleopatra", though, with a run time of 3 hours 42 minutes (4 hours 20 minutes on the restored DVD).
So which movie is the longest? I guess that depends on what you call a "movie" and not a TV series or experimental film. It also depends on whether you count only the theatrical release times, or if you allow for director's cuts, and whether or not you only count Hollywood movies. I hope I gave you a few options, though.