We propose cross-layer optimization frameworks for multihop wireless networks using cooperative diversity. These frameworks provide solutions to fundamental relaying problems of determining who should be relays for whom and how to perform resource allocation for these relaying schemes jointly with routing and congestion control such that the system performance is optimized. We present a fully distributed algorithm where the joint routing, relay selection, and power allocation problem to minimize network power consumption is solved using convex optimization. Via dual decomposition, the master optimization problem is decomposed into a routing subproblem in the network layer and a joint relay selection and power allocation subproblem in the physical layer, which can be solved efficiently in a distributed manner. We then extend the framework to incorporate congestion control and develop a framework for optimizing the sum rate utility and power tradeoff for wireless networks using cooperati...