Depth matching of multiple logging curves is essential to any well evaluation or reservoir characterization. Depth matching can be applied to various measurements of a single well or multiple log curves from multiple wells within the same field. Because many drilling advisory projects have been launched to digitalize the well-log analysis, accurate depth matching becomes an important factor in improving well evaluation, production, and recovery. It is a challenge, though, to align the log curves from multiple wells due to the unpredictable structure of the geologic formations. We have conducted a study on the alignment of multiple gamma-ray well logs by using the state-of-the-art machine-learning techniques. Our objective is to automate the depth-matching task with minimum human intervention. We have developed a novel multitask learning approach by using a deep neural network to optimize the depth-matching strategy that correlates multiple gamma-ray logs in the same field. Our approach can be extended to other applications as well, such as automatic formation top labeling for an ongoing well given a reference well.