In this paper, a new joint multilevel data encryption and channel coding mechanism is proposed, which is called "multilevel/advanced encryption standard-systematic distance 4-continuous phase frequency shift keying" (ML/AES-SD4-CPFSK). In the proposed scheme, we have not only taken advantage of spatial diversity gains but also optimally allocated energy and bandwidth resources among sensor nodes as well as providing high level of security and error protection for cooperative communications in wireless sensor networks. Relay protocols of cooperative communications, such as amplify-and-forward and decode-and-forward with/without adversary nodes, have been studied for 4CPFSK, 8CPFSK, and 16CPFSK of ML/AES-SD4-CPFSK. We have evaluated the error performances of multilevel AES for data encryption, multilevel SD-4 for channel coding, and various CPFSK types for modulation utilizing cooperative communications in wireless sensor networks. According to computer simulation results, significant diversity gain and coding gain have been achieved. As an example, bit error rate (BER) performance of 10(-5) value has been obtained at a signal-to-noise ratio (SNR) of -6 dB for SD-4-CPFSK scheme in a compared related journal paper, whereas in our proposed system, we have reached the same BER value at a SNR of -23 dB with amplify-and-forward with direct path signal protocol in 16-level AES, two-level SD-4 coded 16CPFSK, and at the same time, we have reached the same BER value at a SNR of -22 dB with amplify-and-forward without direct path signal protocol in 16-level AES, two-level SD-4 coded 16CPFSK.