Solubilization in detergents is a widely used technique for the isolation of membrane proteins and the study of their properties. Unfortunately, protein stability in detergent micelles can sometimes be compromised. We encountered this issue with xanthorhodopsin (XR) from Salinibacter ruber, which had been previously engineered for expression in Escherichia coli cells. To explore the factors affecting stability and to enhance thermal stability of recombinant XR preparations following solubilization of membranes using n-dodecyl-β-D-maltopyranoside and nickel-affinity chromatography, we developed a series of hybrid proteins based on the homology between XR and a stable rhodopsin from Gloeobacter violaceus (GR). Functional studies of these hybrids and measurements of their melting temperatures revealed the structural elements of XR that account for its notable difference in stability compared to GR, despite their high overall homology of approximately 50 % identical residues. In particular, XR variants with an engineered loop between transmembrane helices D and E, similar to that in GR, demonstrated enhanced stability. However, we found that replacing the DE loop affects carotenoid binding. Additionally, two hybrid proteins containing the C and D helices from GR exhibited increased stability as well as improved photocycle and proton transport rates. In conclusion, we have demonstrated that optimizing the amino acid sequence of xanthorhodopsin from S. ruber based on its homology with Gloeobacter rhodopsin is an effective approach to enhance its thermal stability in vitro and improve its potential for optogenetic applications.