James 5:16 (NIV) alludes to the possibility that sin can cause sickness in believers:
Therefore confess your sins to each other and pray for each other so that you may be healed. (emphasis mine)
That said, if a believer is sick, and if he discerns that his sickness is due to sin, he should consider making an appointment with an elder of his church, and confessing his sin to the elder, and having the elder pray for him and anointing him (that is, the sick believer) with oil (James 5:14-15, NIV):
14 Is anyone among you sick? Let them call the elders of the church to pray over them and anoint them with oil in the name of the Lord. 15 And the prayer offered in faith will make the sick person well; the Lord will raise them up. If they have sinned, they will be forgiven.