The evolution of the Internet of things (IoT) has increased the connection of personal devices, mainly taking into account the habits and behavior of their owners. These environments demand access control mechanisms to protect them against intruders, like Sybil attacks, that can compromise data privacy or disrupt the network operation. The social IoT paradigm enables access control systems to aggregate community context and sociability information from devices to enhance robustness and security. This work introduces the ELECTRON mechanism to control access in IoT networks based on social trust between devices to protect the network from Sybil attackers. ELECTRON groups IoT devices into communities by their social similarity and evaluates their social trust, strengthening the reliability between legitimate devices and their resilience against the interaction of Sybil attackers. NS-3 simulations show the ELECTRON performance under Sybil attacks on several IoT communities so that it has gotten to detect more than 90% of attackers in a scenario with 150 nodes into offices, schools, gyms, and parks communities, and in other scenarios for same communities, it achieved around of 90% of detection. Furthermore, it provided high accuracy, over 90%-95%, and false positive rates closer to zero.