The longest non-stop (by Wikipedia source) flight was Newark to Singapore on Singapore Airlines flight SQ21 which is and 18 hour 50 minute flight of some 15,345km. However, as of November 2013, Singapore Airlines has discontinued this route.
However for single flight number, allowing stopover, Things are hard to research. Not many websites list tables of distances by flight number. So I resorted to thinking of a route and then looking on the airline websites to see if it was one flight number or split over two flight numbers.
I suspect the longest route that could be a single flight number and have a stopover would be Northern Europe to Australia. So I searched on several airlines for flights. I found a few contenders (but no definitive answers):
NZ1 and NZ38, both on Air New Zealand fly London to Auckland with a stop in Hong Kong in 26 hours and 40 minutes. A distance of 18,463 km.
QF320 on Qantas and BA15 on British Airways fly London to Sydney with a stopover in Singapore. They both take 22 hours and 50 minutes.
QF1 on Qantas goes from Sydney to London, again stopping in Singapore and is 23 hours and 25 minutes.