The Messenger of Allah ﷺ said, "When one of you performs ablution and does it well, then heads to the mosque with nothing motivating him but the prayer and seeking nothing but the prayer, he does not take a single step without Allah raising him a degree by it and erasing a sin from him by it, until he enters the mosque. Once he enters the mosque, he is considered to be in prayer for as long as the prayer is what keeps him there."
حدثنا أبو بكر بن أبي شيبة حدثنا أبو معاوية عن الأعمش عن أبي صالح
قال رسول الله ﷺ إذا توضأ أحدكم فأحسن الوضوء ثم أتى المسجد لا ينهزه إلا الصلاة لا يريد إلا الصلاة لم يخط خطوة إلا رفعه الله بها درجة وحط عنه بها خطيئة حتى يدخل المسجد فإذا دخل المسجد كان في صلاة ما كانت الصلاة تحبسه