Targeting specific protein–protein interactions (PPIs) is an attractive concept for drug development, but hard to implement since intracellular antibodies do not penetrate cells and most small-molecule drugs are considered unsuitable for PPI inhibition. A potential solution to these problems is to select intracellular antibody fragments to block PPIs, use these antibody fragments for target validation in disease models and finally derive small molecules overlapping the antibody-binding site. Here, we explore this strategy using an anti-mutant RAS antibody fragment as a competitor in a small-molecule library screen for identifying RAS-binding compounds. The initial hits are optimized by structure-based design, resulting in potent RAS-binding compounds that interact with RAS inside the cells, prevent RAS-effector interactions and inhibit endogenous RAS-dependent signalling. Our results may aid RAS-dependent cancer drug development and demonstrate a general concept for developing small compounds to replace intracellular antibody fragments, enabling rational drug development to target validated PPIs.