All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
The place is clean and pure unless there is certainty of the opposite. So, if a dog simply slept in that place, this does not make the place impure. In fact, the condition for impurity occurs when something gets in contact with a dog such as wetness on either of them.
An-Nawawi said: “… there is no difference between the licking of the dog and its other parts. So, if its urine, dung, blood, hair, and saliva come in contact with a pure thing, that thing should be washed seven times, once at least, with sand. The same ruling applies if a dog's organ gets in corporal touch with any pure thing while one of them is wet.”
So, if you are certain of the impurity anywhere in the house because of contact with a dog according to these conditions, then you should wash that place seven times, one of which with sand. This is the opinion of the majority of scholars. Some are of the view that seven times are a condition to purify the licking only; as for other impurities from the dog they can be cleaned once like all other impurities. An-Nawawi said: “This opinion is strong and it is backed by evidence.”
So, if the ground is sandy, it can be purified by washing it seven times without using sand as it is already sandy. If it is not sandy, then the water is mixed with sand in the seventh washing until the sand gets to all parts of the ground.
As for waiting forty days, that is not correct and not necessary.
For more benefit on how to purify a house where a dog lived, please refer to Fatwa 228397.
For more benefit on the ruling of the impurity of dogs, please read to Fatwa 82644.
Allah knows best.