An accurate near-surface velocity model is critical for weathering statics correction and initial model building for depth migration and full-waveform inversion. However, near-surface models from refraction inversion often suffer from errors in refraction data, insufficient sampling, and over-simplified assumptions used in refraction algorithms. Errors in refraction data can be caused by picking errors resulting from surface noise, attenuation, and dispersion of the first-arrival energy with offset. These errors are partially compensated later in the data flow by reflection residual statics. Therefore, surface-consistent residual statics contain information that can be used to improve the near-surface velocity model. We have developed a new dataflow to automatically include median and long-wavelength components of surface-consistent reflection residual statics. This technique can work with any model-based refraction solution, including grid-based tomography methods and layer-based methods. We modify the cost function of the refraction inversion by adding model and data weights computed from the smoothed surface-consistent residual statics. By using an iterative inversion, these weights allow us to update the near-surface velocity model and to reject first-arrival picks that do not fit the updated model. In this nonlinear optimization workflow, the refraction model is derived from maximizing the coherence of the reflection energy and minimizing the misfit between model arrival times and the recorded first-arrival times. This approach can alleviate inherent limitations in shallow refraction data by using coherent reflection data.