There is only one hadith i know of, which is related to this dua, which is:
Sa’d ibn Waqas (radiAllahu anhu) reported that the Prophet (salAllahu
allayhi wasalam) said, “The supplication made by the Companion of the
Fish (Prophet Yunus (as)) in the belly of the fish was (the above). If
any Muslim supplicates in these words, his supplication will be
accepted/responded to.” In another report we read, “I know words that
will cause Allah to remove one’s distress. These are the words (of
supplication) of my brother Yunus, peace be upon him” [at-Tirmidhi;
3500, an-Nisa’i in `Amal al-yawmi wa al-layla; #656, al-Hakim 1:505
and 2:383. The latter declared it sound (sahih) and Dhahabi confirmed
So far, only this hadith proves its importance, and you can clearly see that there is absolutely nothing like when to read it, how many times read it etc. So you can read it any time, or the times, where duas are accepted mote
Please be Very Very careful in people telling you about how to recite, which dua or verse of Quran, how many times, UNLESS there is an authentic reference available for it in Quran and hadith clearly. If you read this dua 40 times daily, in a way that its part of islam,then it is Biddat and evert biddat is going to lead us to hell fire.
So please be careful. Only stick to, what is in Quran and hadith.