LoRaWAN represents a promising Internet of things (IoT) technology that has recently gained high a market and academic interest. With the recent advances in sensory manufacturing, the number of connected devices increases dramatically and thus, a reliable IoT system able to provide the coverage for such system becomes a high demand. This paper proposed a reliable LoRaWAN architecture for ultra-dense IoT networks. The mobile edge computing is proposed to provide the computing and energy resources at the edge of the access LoRa network, while the software defined networking (SDN) is deployed at the core network to manage and control the whole network traffic. The novelty of the proposed system comes from the deploying of a distributed version of the SDN controller at the edge servers, to reduce the load on the core network. The system is simulated for various simulation scenarios and the results validate the proposed structure for ultra-dense and ultra-low latency IoT networks. © 2019, Springer Nature Switzerland AG.