God does not give eternal life based on behavior, so He certainly will not withdraw it based on behavior.
Eternal life has absolutely nothing to do with how well you have or have not behaved. Instead we have to come to God recognizing that we are sinners who in no way deserve to live forever with Him. God’s standard is perfection and we have broken that standard. Romans 3:23 tells us, “For all have sinned and fall short of the glory of God.” It takes one sin to separate us from God forever.
Never once content to watch from Heaven, God intervened for humanity. Jesus Christ paid for all of our sins by coming into the world as the perfect Son of God and dying as our substitute. He took the punishment we deserved and died in our place. Romans 5:8 reads, “But God demonstrates His own love toward us, in that while we were still sinners, Christ died for us.” After 3 days, He arose as proof that God accepted His Son’s payment for everything we would do below His perfect standard.
That’s why in order to live forever, we have to come God as a sinner, recognize Christ died for us and rose the third day, and place our trust in Christ alone as our only way to heaven. The moment we do, in accordance with His promise, He gives us the free gift of eternal life. Jesus declared in John 6:47, “Most assuredly, I say to you, he who believes in Me has everlasting life.”
Once we come to Christ, God wants us to live a life that demonstrates our gratitude for our salvation. When we do wrong, God wants us to acknowledge that we have sinned so we can live in close fellowship with Him. Our eternal life is never in jeopardy, because it’s not anchored to us. It’s anchored in what Christ did on the cross and what He did is finished (John 19:30).