In this work, we propose a method based on nonlinear optimization to process holograms corrupted with nonuniform intensity fluctuations in digital holographic microscopy. Our method focuses on formulating an objective function from the recorded signal and subsequently minimizing it using a second-order optimization algorithm. We demonstrate the effectiveness of our method for phase extraction in the presence of severe noise and rapid intensity variations through extensive numerical simulations. Further, we validate the practical applicability of our method for nanoscale surface topography of standard test samples in digital holographic microscopy.