In this passage John is talking about the love of God and how we know that we are His sons. His threefold test is includes practical righteousness, brotherly love, and the confession that Jesus has come in the flesh. It is virtually identical to the previous portion of the letter where he uses this same criteria to show how know that we have fellowship with God. We can then deduce that God’s sons also have fellowship with Him.
Much of what I have read on this passage uses it to distinguish between Christians and unbelievers. It is supposed to show that you can identify a Christian because he is not engaged in sin in an ongoing fashion. I think that’s part of what John is writing here but I think his point goes beyond. John uses sweeping language that makes you ask where to draw the line between struggling with sin and deliberately sinning.
I believe that John here is drawing contrasts between the son of God and the son of the devil to edify us. We are now sons of God and a son of God is born of Him. God is righteous and there is no sin Him and as children reflect their parents so must we resemble our holy Father. That means there can be no sin in us, only righteousness. These are ideals which should imperfectly manifest themselves in believers.
John tells us that sin is incompatible with being a child of God for several reasons in 3:4-9. Sin is a transgression against the law. There is no sin in Jesus, who was manifested to take away our sins. Those who sin have not seen God and do not know Him. They are the ones whom Christ will turn away at the judgment even though they appeared to be His followers. As mentioned earlier, those who sin are of the devil and Jesus came to destroy the works of the devil. Lastly, we who are born of God have His seed in us and thus cannot sin.
When you read through the letter it becomes very clear by the repetition that love, righteousness, and the confession that Jesus has come in the flesh are the qualities that distinguish the disciples of Christ. I am reminded of Paul’s contrast between the spiritual and carnal mind in Romans 8. He says there that if we have the spirit of Christ in us then our flesh has died and we are now a new creation. Likewise, we are now made sons of God, and yet it is also an ongoing, unfolding process which will be complete at Jesus’ return. So I think a good summary of this is that we are righteous and also becoming righteous.