SummaryAn integral part of security infrastructure is detecting and identifying malicious attacks commonly found in network environments. Despite its effectiveness at identifying anomalous network behaviors, an intrusion detection system (IDS) still has a low detection rate and a high rate of false alarms. This study proposes a novel effective anomaly IDS by integrating bio‐inspired optimization techniques, Harris hawk optimization (HHO), and an artificial neural network (ANN), called HHO‐ANN. Several experiments were conducted with other methods to verify the performance and capabilities of the proposed technique. The AWID, CIDDS001, NSL‐KDD, and NSL‐KDD datasets were used to benchmark the performance of the proposed method. Popular evolutionary algorithms, such as genetic algorithm, particle swarm optimization, moth‐flame optimization, and locust swarm optimization based on ANN trainer, were implemented to validate the result. Comparison with existing methods in the literature reveals that the proposed method offers more accuracy. Simulation results confirm that the proposed method has excellent speed convergence and a high‐reliability level due to a lower risk of getting stuck in the local minima region. The proposed method achieved accuracy of 96.71%, 98.03%, 98.25%, and 97.95% for AWID, CIDDS‐001, NSL‐KDD, and UNSW‐NB15, respectively.