Array processing techniques for source detection and localization in an underwater acoustic environment are highly sensitive to both environmental modeling errors, such as sound propagation conditions, and sensor gain mismatch. Sonar arrays, which are normally rigorously calibrated before placement, may develop gain mismatch due to mechanical failures or local environmental variations, such as sediment build-up. In order to avoid performance degradation of detection and localization algorithms, a sensor gain calibration process can be carried out periodically. This paper proposes a maximum likelihood algorithm for sensor gain calibration in a shallow water environment. In the presence of environmental uncertainties, a robust algorithm is required, and such an algorithm is consequentially developed. The proposed method is based on the simultaneous estimation of the relative gains and the acoustic transfer function. To improve the accuracy of the sensor gain estimation, a-priori knowledge of the relationship between the sensor gains at different frequencies is exploited. The performance of the proposed calibration method is evaluated via simulations.