Efficient transmission power control is indispensable for cellular networks. It not only provides a high energy efficiency, but also maintains reliable connections. With the emergence of 5G mobile technology, the presence of device-to-device (D2D) communications within the cellular network has stimulated research on radio resource sharing. In this paper, we consider an underlay D2D network operating in a Rayleigh fading channel and propose a power allocation method that assigns transmit power levels to D2D UEs (DUEs) and cellular UEs (CUEs) such that the joint connection probability of DUEs and CUEs is maximized. The approach is formulated as a optimization problem, and we prove that the problem is log concave. Hence, the optimum powers for active UEs can be found easily using modern computational methods. Both the theoretical and simulated results show that the joint connectivity probability is improved by one to two orders of magnitude by applying the optimization procedure compared to conventional LTE open loop power allocation. This dramatic improvement comes at the cost of an increase in UE average transmit power. Thus, the proposed technique is well suited to 5G public safety and disaster relief communication modes where enhanced connectivity is the top priority.