Short answer
Yes. Most Sunni scholars hold that a jinn can enter and affect a human being, based on the Quran and hadith. It is much rarer than people think, though, and many symptoms blamed on jinn are medical or psychological, so see a doctor as well as using ruqyah.
Mainstream Sunni scholars, Hanafis among them, affirm that possession by jinn (sar') can happen; some Mu'tazilis denied it. Treatment is by permitted ruqyah with the Quran and authentic duas, alongside medical care. Going to sorcerers, or using amulets with unknown words, is haram.
The four schools agree on this.
Explanation
The Quran describes people who consume interest rising on the Day of Judgement "as one stands who is being beaten by Satan into insanity" (2:275). Commentators such as al-Qurtubi took this as proof that jinn can touch a person and cause a kind of madness. The Prophet ﷺ also said that Shaytan runs through the son of Adam like blood. There are reports in the books of Sunan of him telling a jinn to leave a person, which hadith scholars graded differently.
But be careful before deciding someone is possessed. Epilepsy, psychosis, depression, panic attacks and trauma can all look frightening, and they need proper treatment. Taking medicine does not go against trust in Allah. A sensible path is to see a doctor and, at the same time, recite ruqyah yourself or have a trustworthy person recite it.
Avoid anyone who charges large sums, beats the patient, asks for the person's name and mother's name to "read" their condition, claims to know the unseen, or writes things you cannot understand. These are signs of sorcery or fraud, and going to such people is haram.
For protection, the Sunnah gives simple daily habits: the morning and evening adhkar, Ayat al-Kursi before sleep, the last two verses of al-Baqarah and the three Quls. The Prophet ﷺ said Shaytan flees from a house in which Surah al-Baqarah is recited. Read more in Jinn in Islam and is ruqyah allowed?
Ask a mufti about your own case. This answer explains the general ruling. When the details of your situation matter, as they do here, ask a qualified mufti and give them the full facts. Where to ask a scholar.
The evidence
Quran, Surah Al-Baqara 2:275
ٱلَّذِينَ يَأْكُلُونَ ٱلرِّبَوٰا۟ لَا يَقُومُونَ إِلَّا كَمَا يَقُومُ ٱلَّذِى يَتَخَبَّطُهُ ٱلشَّيْطَٰنُ مِنَ ٱلْمَسِّ ۚ ذَٰلِكَ بِأَنَّهُمْ قَالُوٓا۟ إِنَّمَا ٱلْبَيْعُ مِثْلُ ٱلرِّبَوٰا۟ ۗ وَأَحَلَّ ٱللَّهُ ٱلْبَيْعَ وَحَرَّمَ ٱلرِّبَوٰا۟ ۚ فَمَن جَآءَهُۥ مَوْعِظَةٌۭ مِّن رَّبِّهِۦ فَٱنتَهَىٰ فَلَهُۥ مَا سَلَفَ وَأَمْرُهُۥٓ إِلَى ٱللَّهِ ۖ وَمَنْ عَادَ فَأُو۟لَٰٓئِكَ أَصْحَٰبُ ٱلنَّارِ ۖ هُمْ فِيهَا خَٰلِدُونَ ﴿٢٧٥﴾
Those who consume interest cannot stand [on the Day of Resurrection] except as one stands who is being beaten by Satan into insanity. That is because they say, "Trade is [just] like interest." But Allah has permitted trade and has forbidden interest. So whoever has received an admonition from his Lord and desists may have what is past, and his affair rests with Allah. But whoever returns to [dealing in interest or usury] - those are the companions of the Fire; they will abide eternally therein.
Used by commentators as proof that Shaytan can touch a person and affect the mind.
Sahih al-Bukhari 2038
Sahih... إِنَّ الشَّيْطَانَ يَجْرِي مِنَ الإِنْسَانِ مَجْرَى الدَّمِ ...
"Shaytan runs through the human being like blood."
Shows that devils can reach inside a person.
Sahih Muslim 780
Sahih... إِنَّ الشَّيْطَانَ يَنْفِرُ مِنَ الْبَيْتِ الَّذِي تُقْرَأُ فِيهِ سُورَةُ الْبَقَرَةِ ...
"Shaytan flees from the house in which Surah al-Baqarah is recited."
Gives a practical means of protection.
Where the ruling is recorded
- Tafsir al-Qurtubi, Commentary on Surah al-Baqarah, the verses on riba. Takes 2:275 as proof against those who deny that jinn can cause possession.
- Akam al-Marjan fi Ahkam al-Jann (al-Shibli al-Hanafi), Chapters on what the jinn can do to human beings. A Hanafi judge's work gathering the reports and rulings about the jinn.
Checked by our team. For a more accurate answer to your own situation, consult a scholar. Quran translation by Sahih International. Hadith Arabic from the standard editions of the six books and the Muwatta, with gradings as recorded there; the English is our own rendering. Spotted a mistake? Tell us.