Abdullah bin Abbas reported,

Concerning Allah's words عز وجل, "And do not be loud in your prayer, nor be too quiet in it", Ibn Abbas said that this was revealed while the Messenger of Allah ﷺ was still in hiding in Makkah. Whenever he prayed with his companions he would raise his voice. Ibn Munee said, he would recite the Quran aloud. When the polytheists heard his voice, they would revile the Quran, the One who sent it down, and the one who brought it. So Allah عز وجل said to His Prophet ﷺ, "And do not be loud in your prayer", meaning in your recitation, so that the polytheists hear it and revile the Quran, "nor be too quiet in it", keeping it from your companions so that they cannot hear it, "but seek a way between that".

Nasai 1012

Sahih

أخبرنا أحمد بن منيع ويعقوب بن إبراهيم الدورقي قالا حدثنا هشيم قال حدثنا أبو بشر جعفر بن أبي وحشية وهو ابن إياس عن سعيد بن جبير

عن ابن عباس

في قوله عز وجل {ولا تجهر بصلاتك ولا تخافت بها} قال نزلت ورسول الله ﷺ مختف بمكة فكان إذا صلى بأصحابه رفع صوته وقال ابن منيع يجهر بالقرآن وكان المشركون إذا سمعوا صوته سبوا القرآن ومن أنزله ومن جاء به فقال الله عز وجل لنبيه ﷺ {ولا تجهر بصلاتك} أي بقراءتك فيسمع المشركون فيسبوا القرآن {ولا تخافت بها} عن أصحابك فلا يسمعوا {وابتغ بين ذلك سبيلا}

النسائي 1012صحيح
Contents
Reference
Commentary
Ayat
Collection
Sunan Nasai Sughra
Book
Commencement
Chapter
Repeating the verse
Numbering
Darussalam 1012
Nasai 1012