Communication networking leverages emerging network technologies such as topology management schemes to satisfy the demand of exponentially increasing devices and associated network traffic. Particularly, without efficient topology management, Machine-to-Machine (M2M) communications will likely asymmetrically congest gateways and eNodeBs in 3rd Generation Partnership Project (3GPP) Long-Term Evolution (LTE) and Long-Term Evolution Advanced (LTE-A) networks, especially when M2M devices are massively deployed to support diverse applications. To address this issue, in this paper, we propose a 3D Topology Optimization (3D-TO) scheme to obtain the optimal placement of gateways and eNodeBs for M2M communications. By taking advantage of the fact that most M2M devices rarely move, 3D-TO can specify optimal gateway positions for each M2M application, which consists of multiple $M$ 2 $M$ devices. This is achieved through global optimization, based on the distances between gateways and M2M devices. Utilizing the optimization process, 3D-TO likewise determines optimal eNodeB positions for each M2M application, based on the distances between eNodeBs and optimal M2M gateways. Our experimental results demonstrate the effectiveness of our proposed 3D-TO scheme towards M2M communications, with regard to throughput, delay, path loss, and packet loss ratio.