Recently, there has been an increasing reliance on cloud computing for storing and processing data, along with the need to ensure strong security and privacy measures. Current methods face difficulties in efficiently optimizing keyword generation, securing cryptographic keys, and improving data retrieval efficiency in cloud environments. Therefore, this paper introduces a methodology for securing and retrieving sensitive data in cloud computing. It starts with Keyword extraction from file using the Rapid Automatic Keyword Extraction (RAKE) algorithm, which ranks phrases based on their significance to select relevant keywords. Then, the Optimal Key Generation uses the Directional Mutated Beluga Whale Optimization (DMBWO) Algorithm to improve key generation and enhance cryptographic security. The Encryption phase employs the Hybrid Serpent Blowfish (HSB) Algorithm for robust data protection. For data retrieval, K-means clustering is used in the Upload phase to facilitate faster searches through organized data clusters, while a Lookup Table mechanism enhances search efficiency by associating keywords with encrypted data and creating trapdoors for secure user requests. Finally, in the Decryption phase, the HSB algorithm reverses encryption securely to ensure accessibility of data.