Long Range (LoRa) is a wireless communication standard specifically targeted for resource-constrained Internet of Things (IoT) devices. The number of LoRa-based networks is growing due to its operation in the unlicensed radio bands and the ease of network deployments. However, the scalability of LoRa networks suffers as the number of deployed devices increases. In particular, network performance drops due to increased contention and interference in the unlicensed radio bands. Nevertheless, network performance can be improved by appropriately configuring each node's radio parameters. To this end, we formulate integer linear programming models to configure LoRa nodes with optimal parameters such that all devices can reliably send data with low energy consumption. We evaluate the performance of our solution through extensive network simulations. We find that our solution consistently achieves a higher delivery ratio than the state of the art with minimal energy consumption.