How does distance control depth of field?
The closer your subject is to the camera, the shallower your depth of field becomes. Therefore, moving further away from your subject will deepen your depth of field.
How does the focal length of a lens control depth of field?
Focal Length refers to the capability of a lens to magnify the image of a distant subject. This can get complicated, but the simple answer is that the longer you set your focal length the shallower the depth of field. Example: Your subject is 10 meters (33 feet) away, using a focal length of 50mm at f/4; your depth of field range would be from 7.5 -14.7 meters (24.6-48 feet) for a total DOF of 7.2 meters (23.6 feet). If you zoom into 100mm from the same spot, the depth of field changes to 9.2-10.9m (30.1-35.8′) for a total of 1.7m (5.7′) of depth of field. But if you move to 20m (66′) away from your subject using the 100mm lens, your depth of field is almost the same as it would be at 10 meters using a 50mm lens.