The ciliary muscle is an intrinsic muscle of the eye formed as a ring of smooth muscle in the eye's middle layer, the vascular layer or uvea. It controls accommodation for viewing objects at varying distances and regulates the flow of aqueous humour into Schlemm's canal. It also changes the shape of the lens within the eye but not the size of the pupil which is carried out by the sphincter pupillae muscle and dilator pupillae.

The ciliary muscle plays a key role in the accommodation reflex, the reflex action of the eye, in response to focusing on a near object, then looking at a distant object. The circular ciliary muscle fibres affect zonular fibres in the eye. those that suspend the lens in position during accommodation. This enables changes in the shape of the lens for light focusing.

When the ciliary muscle contracts, it pulls itself forward and moves the frontal region toward the axis of the eye. This releases the tension on the lens caused by the zonular fibres, the ones that hold or flatten the lens. This release of tension of the zonular fibres causes the lens to become more spherical, adapting to short range focus. Conversely, relaxation of the ciliary muscle causes the zonular fibres to become taut, flattening the lens, increasing the focal distance, increasing long range focus.

More Info: en.wikipedia.org