Are there any algorithms that, for example, take neighboring pixels into consideration in order to determine a better estimation for each pixel?
That would essentially be a low-pass filter.
So, yes, that exists, and is commonly used.
You can see that very nicely if you take e.g. an old computer graphics sprite, and scale it as a high-color-resolution image:
original (32 x 32 px)
scaled without interpolation filter (512 px)
scaled by a simple linear interpolation filter (512 px)
While the simply scaled image has as much discrete colors as the original, the linearly interpolated one has a lot more colors, and the histogram looks much more "continuous".
There's no free lunch, usually. You can't just add color information back! (not being able to add back lost info is one of the fundamental truths of Information Theory, by the way). You have to sacrifice spatial resolution. Essentially, it's the same math that underlies Heisenberg's Uncertainty Principle. You can either have perfect info state of something (the color of a pixel, the impulse of a electron), or its position (sharp edges in an image, knowledge of the position of an electron). See this example:
original (512 x 512px) reduced to 16 colors
filtered to achieve a much more continuous color histogram, with a radius of 10px taking into consideration