The Industrial Internet-of-Thing (IIoT) has been considered as one of the most challenging application scenarios in future wireless networks. In this paper, we investigate how to improve the overall reliability of massive IIoT networks by optimizing user association. Specifically, the decoding error probability in the physical layer and the collision probability with grant-free random access are taken into account. We first propose a centralized optimization algorithm to achieve a good balance between decoding errors and collisions. To reduce computational complexity and communication overheads of the centralized optimization algorithm, a deep neural network (DNN) is trained offline in the central server and executed by each user in a distributed manner. Our results show that the communication overheads of the distributed DNN do not increase with the number of users, and the reliability achieved by the distributed DNN is close to the centralized optimization algorithm. In addition, the distributed DNN can reduce the packet loss probability by 40% when compared with an existing policy, where each user is connected to the base station with the highest signal-to-noise ratio.