Easiest way is to increase your f-stop. Switch your camera mode to Aperature Priority or full Manual and then manually set the f-stop, usually 8 or higher to make any difference. Different lenses react more or less but they all increase the focus depth-of-field as you raise the f-stop. Then you want to set your focus point half-way between the objects you want to be in focus. If your camera has a preview button, push it to make sure both objects are in focus. If they are not then raise the f-stop further. Raising the f-stop will also make any shot crisper and make a cheaper lens act like a more expensive one. The trade-off is shutter and "film" speed, you need one hell of a sunny day to run ASA 100, F-22 at 1/1000th.
Long lenses shooting at farther distances naturally have larger depth-of-field but at greater cost/weight/vibration and lower base speed.
Hope this helps,
Tom.