LoRa is well-known for its extensive communication range, inexpensive efficiency, and reduced or less power consumption in end devices. Enddevice energy consumption in LoRa networks is ludicrous because some end-devices use massive dissemination variables to reach the remote doorway. Furthermore, the batteries in these end devices deplete very quickly, reducing network life significantly. To address this issue, an optimal mixed-integer linear programming long-range technique (OMILP-LoRa) was used in this study. The primary goal of this research is to enable adaptive resource allocation using the unique OMILP-LoRa protocol. The ACCURATE heuristic and the OMILP model for LoRaWAN resource allocation are presented in this work. The ACCURATE method was used to dynamically modify the spreading factor (SF) and carrier frequency (CF) configurations for every LoRaWAN IoT devices. The results shows the ACCURATE heuristic produces results that are related to the optimal obtained through the OMILP-LoRa device for channel use, increasing the placement of LoR-aWAN, steps to prevent collisions, and enhancing the complete system. The suggested method's performance includes a comparison of the proposed approach to different existing methods, including the ILP, LoRa, and MILP methods.