How to Avoid Lack of Concentration in Prayers

Many a time do people get distracted from their prayers, thinking about worldly affairs. Does this affect the reward of their prayers? And what should they do to avoid lack of concentration during prayer?