Try to restore, or more exactly, to enclose your thought in the words of the prayer. If on account of its infancy it wearies and wanders lead it in again. The mind is naturally unstable. But He Who orders all things can control it. If you aquire this practie and constantly restrain it, He Who sets bounds to the sea of your mind will say to it during your prayer: Hitherto thou shalt come, and shalt go no further (Job 38:11). It is impossible to bind a spirit. But where the Creator of the spirit is present, there everything obeys Him.
The beginning of prayer consists in banishing the thoughts that come to us, at their very appearance; the middle is when the mind says soley in the words pronounced vocally or mentally. Constantly struggle with your thoughts and whenever it is carried hither and thither, collect it together. God does not require from you prayer completely free from distractions. Do not despond when your thought is distracted, but remain calm, and unceasingly restore your mind to itself.
St. John Climacus, The Ladder of Divine Ascent, tr. Fr. Lazarus (Moore), revised edition (Boston: Holy Transfiguration Monastery, 1978).