In susceptibility-weighted imaging and quantitative susceptibility mapping, phase unwrapping methods are generally needed to restore the underlying true phase from the principal period (-π, π]. However, current phase unwrapping algorithms are challenged by noise, rapid phase changes and open-end cutlines. In this paper, a 2D phase unwrapping method based on pixel clustering and local surface fitting (CLOSE) was extended to 3D. The simulation and in vivo data is used to test the performance of the proposed method, with a comparison to a region growing method and PRELUDE, which are widely used for human brain phase-related imaging. The proposed method is demonstrated that can accurately unwrap 3D phase data even in the presence of severe noise, rapid phase changes, and open-end cutlines, and will benefit phase-related 3D MRI applications.