The light quantity, responsible for the sharpness, which reaches the sensor, is called exposure and it is controlled through two variables: the exposure time and the diaphragm.
Imagine that the sensor is a glass that you fill with water until the water reaches a certain level.
You can control the action by the time you leave the tap open-the equivalent of the time of exposure; and the water flow – the equivalent of the diaphragm.
The exposure can be controlled through setting the ISO sensibility, a method through which we electronically amplify the native exposure of the sensor but also the noise.
Since the diaphragm controls the depth of the field responsible for the sharpness of the digital picture it is only natural that the sharpness of the photography will be conditioned by how clear is the object compared to the blurry background.
The depth of the field also depends on the focal distance of the objective. If the focal distance is large the depth will be very low.
Closing the diaphragm will increase the clarity depth enough so together with other performances of the objective like resolution, contrast and flare resistance will have as result an increasing sharpness of the image.