The combination of idle computing resources in mobile devices and the computing capacity of mobile edge servers enables all available devices in an edge network to complete all computing tasks in coordination to effectively improve the computing capacity of the edge network. This is a research hotspot for 5G technology applications. Previous research has focused on the minimum energy consumption and/or delay to determine the formulation of the computational offloading strategy but neglected the cost required for the computation of collaborative devices (mobile devices, mobile edge servers, etc.); therefore, we proposed a cost-based collaborative computation offloading model. In this model, when a task requests these devices' assistance in computing, it needs to pay the corresponding calculation cost; and on this basis, the task is offloaded and computed. In addition, for the model, we propose an adaptive neighborhood search based on simulated annealing algorithm (ANSSA) to jointly optimize the offloading decision and resource allocation with the goal of minimizing the sum of both the energy consumption and calculation cost. The adaptive mechanism enables different operators to update the probability of selection according to historical experience and environmental perception, which makes the individual evolution have certain autonomy. A large number of experiments conducted on different scales of mobile user instances show that the ANSSA can obtain satisfactory time performance with guaranteed solution quality. The experimental results demonstrate the superiority of the mobile edge computing (MEC) offloading system. It is of great significance to strike a balance between maintaining the life cycle of smart mobile devices and breaking the performance bottleneck of MEC servers.