I was wondering how a person can control or even exterminate the satanic thoughts. In my story. It’s when I am listening to a lecture and shaytans comes around the corner and says what if this isn’t real (talking about religion) and I know my mind isn’t saying this because I believe in all of it. How do stop the shaytan from doing that?

When you get such doubts, challenge Shaytan and go back to the basics. Go back to certainty. Hold on to what you know and fight him with that.

Also, seek refuge in Allah for the accursed Satan.

Also recite this Dua:

سبحان الله ملء سماواته وأرضه، ومداد كلماته، وزنة عرشه، ورضا نفسه

And this Dua:

آمنت بالله ورسوله مخلصا له الدين

You may also see this video:

42- (17) Usul al-Kafi – Protecting Oneself from Doubts – Sayed Mohammad Baqer Qazwini
https://youtu.be/JqOgaN_GO3o