That depends! There are many things to consider when choosing how to sleep while camping, including comfort and practicality. Both air mattresses and sleeping pads provide a buffer between you and the ground while you sleep. The main benefit of an air mattress is comfort—especially for side sleepers and people with body pain. If you tend to wake up sore after a long night sleeping on the hard ground, an air mattress can make camping much more comfortable.
But if you need something compact and lightweight, a sleeping pad is a better choice. These pads roll up smaller than an air mattress, making them easier to take on long hiking trips. A good middle ground is an inflatable sleeping pad, which provides more cushion than an all-foam pad while taking up less space than an air mattress.