In the contemporary era, the abundant availability of health information through internet and mobile technology raises concerns. Safeguarding and maintaining the confidentiality of patients' medical data becomes paramount when sharing such information with authorized healthcare providers. Although electronic patient records and the internet have facilitated the exchange of medical information among healthcare providers, concerns persist regarding the security of the data. The security of Electronic Health Record Systems (EHRS) can be improved by employing the Cuckoo Search Algorithm (CS), the SHA-256 algorithm, and the Elliptic Curve Cryptography (ECC), as proposed in this study. The suggested approach involves using CS to generate the ECC private key, thereby enhancing the security of data storage in EHR. The study evaluates the proposed design by comparing encoding and decoding times with alternative techniques like ECC-GA-SHA-256. The research findings indicate that the proposed design achieves faster encoding and decoding times, completing 125 and 175 iterations, respectively. Furthermore, the proposed design surpasses other encoding techniques by exhibiting encoding and decoding times that are more than 15.17% faster. These results imply that the proposed design can significantly enhance the security and performance of EHRs. Through the utilization of CS, SHA-256, and ECC, this study presents promising methods for addressing the security challenges associated with EHRs.