I think there are some other threads posted regarding the same situation. The problem is somewhat fuel related.
Had the same thing happen to mine. My wife claimed that when the level would get below 1/2, it would one day zip down to R, then back to normal eventually. I never believed her because I couldn't recreate the scenario myself. Then one day while I was driving, Bingo! it happened.
I haven't done anything to solve the problem, and it hasn't happened in ages. So I am of the belief that it is a fuel related problem.
Do a search on "fuel gauge" and you will find some technical descriptions about this cause.
2009 ML350 (84K) - Family vehicle
2001 CLK430 Cabriolet (71K) - Wife's car
2005 BMW 645CI (124K) - My daily driver
2012 Mustang V6 (60K) - Daughter's car