I have a non believer friend who has recently confessed that he denied the existence of the Holy Spirit. By denying the existence of the Holy Spirit has he committed the eternal sin and will forever be lost?
By the very fact that he’s an unbeliever, your friend has been denying the existence of the Holy Spirit all along. What’s the big deal in denying the existence of someone you already don’t believe in? And unless he changes his mind and asks the Lord to save him, he is already lost forever anyway (John 3:18).
Even so, denying the existence of the Holy Spirit is a really silly thing to do, because no one can prove He doesn’t exist. But for your friend it’s not an unforgivable sin.
In Matt. 12:24 some Pharisees said that Jesus performed His miracles through the power of Satan. In Matt. 12:31-32 Jesus told them that speaking against the Holy Spirit was a sin that would not be forgiven in this age or in the age to come. He was referring to their claim about Satan being the power behind His miracles, when in fact it was the Holy Spirit who enabled His miracles.
They knew the Scriptures, had interviewed eye witnesses, and were knowledgeable about both Satan and the Holy Spirit. Therefore they were responsible for their actions. Your friend and others like him who think it’s smart to taunt the Lord like this haven’t a clue as to what they’re talking about. They were best described in Psalm 14:1; The fool has said in his heart, “There is no God.”
The best thing you can do is pray that the Lord will reveal Himself to your friend, and when He does that your friend will ask the Lord to forgive him for sins committed in ignorance. Then he who is lost will be found.