G protein-coupled receptors (GPCRs) are the largest class of pharmaceutical protein targets, yet drug development is encumbered by a lack of information about their molecular structure and conformational dynamics. Most mechanistic and structural studies as well as in vitro drug screening with purified receptors require detergent solubilization of the GPCR, but typically, these proteins exhibit only low stability in detergent micelles. We have developed the first directed evolution method that allows the direct selection of GPCRs stable in a chosen detergent from libraries containing over 100 million individual variants. The crucial concept was to encapsulate single Escherichia coli cells of a library, each expressing a different GPCR variant, to form detergent-resistant, semipermeable nano-containers. Unlike naked cells, these containers are not dissolved by detergents, allowing us to solubilize the GPCR proteins in situ while maintaining an association with the protein's genetic information, a prerequisite for directed evolution. The pore size was controlled to permit GPCR ligands to permeate but the solubilized receptor to remain within the nanocapsules. Fluorescently labeled ligands were used to bind to those GPCR variants inside the nano-containers that remained active in the detergent tested. With the use of fluorescence-activated cell sorting, detergent-stable mutants derived from two different family A GPCRs could be identified, some with the highest stability reported in short-chain detergents. In principle, this method (named cellular high-throughput encapsulation, solubilization and screening) is not limited to engineering stabilized GPCRs but could be used to stabilize other proteins for biochemical and structural studies.