In this paper, a modified decision based median filtering approach is presented for the restoration of gray scale and color images that are highly corrupted by salt and pepper noise. It is an enhanced decision based algorithm where noise pixels are detected in several phases based on predefined threshold value. The noise pixels are replaced by median where median value is calculated without considering 0 and 255. As a result, at high density noise environment it is very efficient to find noise free median value. The algorithm initially select 3×3 filtering window for processing corrupted pixel. When all the elements in the window are corrupted, the processing pixel is replaced by noise free last processed pixel. If the last processed pixel is 0 or 255 then the algorithm will create a filtering window with a new dimension to identify pure black and white region of the image. Experiments exhibit better result at 9×9 filtering window. In this stage a standard median filtering approach is applied to determine probable intensity value. If the median value is noise pixel then the algorithm will calculate the mean value of all elements in the window. After that, robust estimation algorithm is applied to the proposed filter to remove discontinuity of pixel intensity and smooth the restored image. Experimental result shows that it can provide very high quality restored images, when the noise density is large.