SummaryAs a burgeoning paradigm, collaborative mobile edge computing (C‐MEC) can cater to growing computation demand of mobile devices (MDs). However, there are great challenges for joint task offloading and resource allocation. In addition, failures on both MDs and edge servers greatly affect reliable task execution. This paper investigates the joint optimization problem of offloading decision, power allocation, and computation resource allocation in the multi‐user C‐MEC system, where nondivisible tasks may be executed locally, offloaded to nearby collaborative devices, or processed by the edge server. We aim at minimizing the total energy consumption of MDs while satisfying the reliability and delay constraints, and the replication technique is adopted to enhance task execution reliability. To tackle this problem, we first transform it into a bi‐level optimization problem, and then propose an iterative algorithm named JOC. Specifically, the offloading decision is constructed in the upper level on the basis of ant colony system (ACS), and the allocation of working power, transmission power, and computation resources is optimized in the lower level by using the monotonic optimization approach. Simulation experimental results reveal that the proposed algorithm saves more energy and achieves a higher task success rate in comparison with baseline schemes.