I understand the principles of depth of field, but am unclear as to what the recommended further distance is when you want to use a lower f stop. Surely at some point, your subject will go out of focus and you should then go to a higher f stop #?
I think your understanding of Depth-Of-Field (DOF) needs some clarification:
We can sharply focus our camera on a subject regardless of camera to subject distance (super close distances fall under special circumstances). If our subject is a person we likely focus on the eyes. If no DOF existed, the eyes would be sharp and clear though the nose and ears would be out-of-focus. The fact is; a zone exits before and after the point focused upon that images with reasonable focus. This is the span we call depth-of-field.
The span of acceptable focus is not split down the middle; it extends 2/3 to the rear and 1/3 back towards the camera. For example: Subject at 8 feet, aperture f/11, zone of DOF 6 feet thru 15 feet.
We can expand the length of the zone of DOF by:
a. Using tiny diameter apertures like f/11, or f/16 or f/22
b. Causing the subject to camera distance to increase
c. Mounting a short focus (wide-angle) lens
We can diminish the length of the zone of DOF by:
a. Using large diameter apertures like f/1/4 or f/1.8 or f/2
b. Placing the subject close to the camera
c. Mounting a longer than normal focal length lens
Related to DOF is a topic called hyperfocal distance: We can consult tables and charts that give the span of DOF for every distance and aperture setting. Likely these same tables will give the hyperfocal distance settings. The hyper focal distance is commonly used by landscape photographers and for those occasions when focusing the camera is a too time consuming or bothersome.
Setting the camera to its hyperfocal distance maximizes DOF. Say you find a table that tells you to set your camera at the hyperfocal setting ; focus at the 11 feet mark, set the aperture at f/16. Now your DOF will span 3 feet to infinity ∞ (as far as the eye can see).
Surely at some point, your subject will go out of focus
You focus on a point. The thing at that point is in focus.
Aperture affects depth of field, i.e. what stuff in front of your focus point and behind your focus point is rendered acceptably in focus. But the thing you have focused on is still in focus, regardless of your aperture setting and/or its distance from you.
The depth of field does indeed depend on focal length, distance to subject and aperture. It also depends, on a lesser degree, on how large you view or print your picture, and on sensor size. You can use a depth-of-field calculator to find the depth of field for a particular combination.
For example, using this calculator, I found that, assuming an APS Nikon camera and a subject distance of 10 feet, things will start to get out of focus at 11 ft from the camera.