First thing is to brace the camera against something to help keep it stable. Try changing it to manual and putting it on Aperature priority and change the aperature(The F number) to somewhere near the top of its range. This will give you a larger depth of focus, which is width of the area that will be in focus. But then, you need a longer shutter time which is why you have to make sure the camera is as stable as possible.
Also, you can usual manual focus if the autofocus is focusing on a different spot than you want or lock the focus by holding the button half down and move the camera back and forth.
Like this picture for example, I had the camera body and lens both resting on the ground to keep it stable: