Internet of bio-nano things (IoBNT) is a novel communication paradigm where tiny, biocompatible and non-intrusive devices collect and sense biological signals from the environment and send them to data centers for processing through the internet. The concept of the IoBNT has stemmed from the combination of synthetic biology and nanotechnology tools which enable the fabrication of biological computing devices called Bio-nano things. Bio-nano things are nanoscale (1-100 nm) devices that are ideal for in vivo applications, where non-intrusive devices can reach hard-to-access areas of the human body (such as deep inside the tissue) to collect biological information. Bio-nano things work collaboratively in the form of a network called nanonetwork. The interconnection of the biological world and the cyber world of the Internet is made possible by a powerful hybrid device called Bio Cyber Interface. Bio Cyber Interface translates biochemical signals from in-body nanonetworks into electromagnetic signals and vice versa. Bio Cyber Interface can be designed using several technologies. In this paper, we have selected bio field-effect transistor (BioFET) technology, due to its characteristics of being fast, low-cost, and simple The main concern in this work is the security of IoBNT, which must be the preliminary requirement, especially for healthcare applications of IoBNT. Once the human body is accessible through the Internet, there is always a chance that it will be done with malicious intent. To address the issue of security in IoBNT, we propose a framework that utilizes Particle Swarm Optimization (PSO) algorithm to optimize Artificial Neural Networks (ANN) and to detect anomalous activities in the IoBNT transmission. Our proposed PSO-based ANN model was tested for the simulated dataset of BioFET based Bio Cyber Interface communication features. The results show an improved accuracy of 98.9% when compared with Adam based optimization function.