Do some test shots and all the full stops.... 2.8, 4, 5.6, 8, etc. and pixel-peep them on your monitor at at least 100%. Determine which aperture gives you the sharpest image as you close it down before diffraction starts to degrade the image. This will usually be in the 8-16 range. Then, if at all possible, shoot at the smallest aperture possible in that range.
Beyond that, if you don't have enough DOF, look into focus stacking.