The volumetric shrinkage behavior of clayey soils under drying has been well examined, whereas the resulting internal mechanical response remains understudied. This work measured the compressive stress induced by desiccation shrinkage in two types of clayey soils along vertical and lateral directions using a flexible pressure sensor embedded in the slurry samples. The stress evolution was investigated in relation to mineralogical compositions, hydromechanical behavior, microstructures and drying conditions. The results highlighted that the compressive stress developed as a consequence of desiccation shrinkage, particularly in clayey soils with a high montmorillonite content. The development of suction beyond the air entry value (AEV) contributed to a notable increase in the compressive stress. This contribution was enhanced in the vertical direction owing to the face-to-face contact between clay platelets. A decrease in environmental relative humidity caused the compressive stress to initiate at lower water content, yet limited the contribution of suction. Moreover, non-uniform lateral desiccation shrinkage along the soil profile activated contact shear effects among clay platelets, hindering the development of lateral compressive stress. With further drying, the suction contribution to the compressive stress decreased since the increasing formation of air-filled pores disrupted the chains of stress transmission. When the shrinkage limit was reached, the compressive stress stabilized as the clay platelets interlocked under high suction. Furthermore, the directly measurable compressive stress can serve as a mechanical reference for characterizing the volumetric shrinkage behavior of drying clayey soils.