The Wireless Sensor Network (WSN) is a network which is composed of many sensor nodes. The sensor nodes in WSN are widespread and lightweight which are deployed for environmental or system monitoring. These sensor nodes within the WSNs communicate with one another using wireless lines. WSNs have practical applications in numerous fields such as smart city, medicine, military, agriculture, and so forth. It is easy for an adversary to intercept the network and steal the valuable information. Consequently, these sensor nodes need enhanced security. Recently, Kwon et al have proposed an authentication scheme for WSNs. However, in this paper, we analyze the security of their scheme and discover that their protocol fails to provide perfect forward security and user untraceability. Also their protocol fails to withstand against session specific random number leakage attack, privileged insider attack and password guessing attack. Their protocol uses only two-factor authentication scheme.In order to overcome the weaknesses of their protocol, we develop a secure three-factor authentication protocol which is based on symmetric key cryptography. We use ProVerif tool to perform its formal security verification and use random oracle model for its formal security analysis. We also show the correctness of mutual authentication of the proposed scheme using BAN logic. Its informal security analysis indicates that the designed scheme can withstand against various known attacks. In the performance analysis, we show that the proposed scheme offers more security features than the other related schemes and has less communication cost as compared to Kwon et al protocol.