I am having trouble getting good depth of field on close photos. My light is good. Lense is AF-S Micro Nikkor 40 MM 1:2.8 G
Use the smallest aperture your lens is capable of. The smaller the aperture the longer depth of field. F16 to f64 or f128. Use the slowest ISO that provide enough light or add light If you can. Shutter speed is at least 60th of a second.
Another trick is zoom out as far as you can until your depth of field covers all subjects then use photoshop to zoom in.