Flexible sensing devices provide a convenient and effective solution for real-time human motion monitoring, but achieving efficient and low-cost assembly of pressure sensors with high performance remains a considerable challenge. Herein, a highly compressible and sensitive flexible foam-shaped piezoresistive pressure sensor was prepared by sequential fixing multiwalled carbon nanotubes and Ti3C2Tx MXene on the skeleton of melamine foam. Due to the porous skeleton of the melamine foam and the extraordinary electrical properties of the conductive fillers, the obtained MWCNTs/Ti3C2Tx MXene @ melamine foam device features high sensitivity of 0.339 kPa−1, a wide working range up to 180 kPa, a desirable response time and excellent cyclic stability. The sensing mechanism of the composite foam device is attributed to the change in the conductive pathways between adjacent porous skeletons. The proposed sensor can be used successfully to monitor human gestures in real-time, such as finger bending and tilting, scrolling the mouse and stretching fingers. By combining with the decision tree algorithm, the sensor can unambiguously classify different Arabic numeral gestures with an average recognition accuracy of 98.9%. Therefore, our fabricated foam-shaped sensor may have great potential as next-generation wearable electronics to accurately acquire and recognize human gesture signals in various practical applications.