LoRa Wide Area Network (LoRaWAN) is one the of the most popular Internet of Things (IoT) technologies for long-range and low-cost communication. At present, LoRaWAN has been applied in a variety of applications, including localization, smart metering, etc. However, the increasing number of LoRaWAN devices would degrade their quality of service (QoS). There are two main reasons. The first reason is the competition of bandwidth and channel resources between large number of connected end devices. Another one is the redundant channel resources allocation configurations of most end devices to achieve better transmission reliability. To address these challenges, this work proposes an enhanced resource allocation scheme based on both k-means and k-prototype classification algorithms to mitigate the affection of ALOHA scheme and the multi-gateway interference problem. In this proposed scheme, intense network resources under dense end device scenario and the redundant claim of network resources configuration in end devices are considered. An outlier improved spreading factor distribution method is also proposed to reduce the negative effect of the problems. By evaluating and comparing packet loss rate and the relative distribution of spreading factors, an average of 22% increment in transmission performance of LoRaWAN networks is achieved.