Protein folding results from an intricate interaction among intrinsic and extrinsic factors like amino acid sequence and solvation environment. The hydrophobic effect primarily drives the water-soluble globular protein to fold adjusted by following side-chain packing, whereas the folding of membrane protein, immersed in the hydrophobic lipid bilayer, is not well understood. The lack of water inside the lipid bilayer diminishes the hydrophobic effect, while the van der Waals packing becomes a crucial driving force. This may imply that the membrane protein interior is tightly packed. Paradoxically, membrane proteins such as channels, transporters, receptors, and enzymes require cavities (i.e., voids, pockets, and pores) for their designated function. Then, how do membrane proteins achieve the stability carrying out function? How does the hydrophobic lipid bilayer engage in stabilizing membrane proteins and residue-wise interaction network? In this presentation, we discuss the dynamic interplay between the lipid bilayer and membrane protein on structure and function using molecular dynamics simulations and experiments. Taking the intramembrane protease GlpG of Escherichia coli as our model system, we investigate how the bilayer stabilize the protein by facilitating the residue burial through a comparative study with micelle environment. We also show that cavities created in membrane proteins can be stabilized by favorable interaction with surrounding lipid molecules and play a pivotal role in balancing stability and flexibility for function through cavity filling mutagenesis.