Mobile social networks and device-to-device (D2D) communications have emerged as promising techniques to support better local advanced services in 5G networks. Nevertheless, the integration of mobile social networks and D2D communications into 5G networks poses pivotal challenges such as how to exploit the social relationships of mobile users (MUs) and manage the interference and resources (i.e., spectrum and energy) in order to improve the performance of D2D communications. To this end, we propose a social-aware energy efficiency optimization solution for D2D communications in 5G networks. In particular, we first analyze and evaluate the influence of social relationships on the performance of D2D communications, which enable us to formulate the energy efficiency optimization (EEO) problem while carefully considering both the social relationships and physical interference between all the MUs. The EEO problem is then solved for optimal channel mode selection and optimal transmission powers allocated to each MU to maximize the energy efficiency, by utilizing adaptive genetic algorithm. Numerical results show that compared with social-unaware methods, our proposed solution can achieve significant improvement in terms of energy efficiency and system throughput while preserving the quality of service (QoS) for all users by taking into account the spectrum efficiency and transmission power constraints.