The function of ciliary muscles is to adjust the lens so that the eye can focus on nearby or far away objects. The process is called accommodation.