All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
Laughing invalidates the prayer if it is loud and boisterous or if two letters or more are articulated when laughing. But it is not invalidated if less than two letters are articulated and it is not boisterous and it is not invalidated from smiling alone.
An-Nawawi said:
“According to our School, smiling does not have a negative effect, nor does laughing if less than two letters are articulated, but if two letters are articulated the prayer is invalid. Ibn Al-Munthir reported a consensus of the scholars that the prayer becomes invalid by laughing, but this is understood to mean if two letters (or more) are articulated. And he said that most of the scholars said that smiling does not have a negative effect. This is the view of Jaabir ibn ‘Abdullaah, ‘Ataa’, Mujaahid, An-Nakha'i, Al-Hasan, Qataadah, Al-Awzaa‘i, Ash-Shaafi‘i and the As-haab Ar-Ra’y. However, Ibn Seereen said: "What I know is that smiling is like laughing (i.e. it invalidates the prayer).” [End of quote]
Ibn Qudaamah said in Al-Mughni:
“If a person laughs and two letters are articulated, his prayer is valid, as well as if one laughs boisterously even without two letters. This is the view of Jaabir bin ‘Abdullaah, ‘Ataa’, Mujaahid, Al-Hasan, Qataadah, An-Nakha‘i, Al-Awzaa‘i, Ash-Shaafi‘i and the As-haab Ar-Ra’y, and we are not aware of anyone having a different opinion. Ibn Al-Munthir said: "The scholars unanimously agreed that laughing invalidates the prayer, and most of the scholars hold that smiling does not invalidate it."”
Allaah Knows best.