In this paper, we propose a joint control scheme to maximize network lifetime in wireless sensor networks with joint contention and sleep control. For the contention resolution of sensor nodes in the network, we consider the p-persistent contention protocol. Also, the sleep control is introduced with the probability of turning off the transceiver of a sensor node. Using the probabilities of contention and sleep, we formulate the network lifetime maximization problem to satisfy the throughput requirement and each link's signal to noise interference ratio (SINR) requirement. Finally, we demonstrate that the proposed scheme improves the lifetime of wireless sensor networks compared to the existing schemes.