Even with the appropriate acquisition of brain images, reliable and accurate brain tumor segmentation is a challenging task. Tumor grading and segmentation employing magnetic resonance imaging (MRI) are necessary for correct diagnosis and treatment planning. There are different MRI sequence images (T1, Flair, T1ce, T2, etc.) for identifying different parts of the tumor. Due to the diversity in the illumination of each brain imaging modality, different information and details can be obtained from each input modality. Therefore, by using various MRI modalities, the diagnosis system is capable of finding more unique details that lead to a better segmentation result, especially in fuzzy borders. In this study, to achieve an automatic and robust brain tumor segmentation framework using four MRI sequence images, an optimized convolutional neural network (CNN) is proposed. All weight and bias values of the CNN model are adjusted using an improved chimp optimization algorithm (IChOA). In the first step, we normalized all four input images to find some potential areas of the existing tumor. Next, we extract 17 features from each object inside the obtained binary image. Next, by employing the IChOA, the best features are selected. Finally, these obtained features are fed to the optimized CNN model to classify each object for brain tumor segmentation. The experimental outcomes conducted on the BRATS 2018 dataset demonstrate superior performance compared to the existing frameworks.