Answered by Sayyidi Habib Umar bin Hafiz (may Allah protect him and benefit us by him)
How can we prevent excessive use of the Internet and mobile devices?
This can be done by focusing the heart on remembrance and reflection. You should remember Allah until His remembrance dominates your heart. You should reflect upon the life of the Prophet ﷺ. This engenders a longing to be in his company and a longing to meet him. You should also avoid keeping the company of those who spend a lot of time using the internet.
Our use of mobile devices must be governed by taqwa, knowledge and intelligence. We must use them in the best way, be in complete control of them and avoid any evil that their use may entail. Making light of a small part of evil leads to a great amount of evil. By using them correctly we are supporting the cause of Allah. One of the first manifestations of victory is in our use of these devices. This is related to our victory in our use of our limbs which points to a victory in our battle with our lower selves. Anyone who is in control of their body and lower self will receive assistance from Allah. Allah says: If you assist Allah, He will assist you and make your feet firm. He also says: Allah will truly assist whoever assists Him. Allah then mentions the signs of those who assist Him: they are those who establish the prayer, pay zakat, enjoin good and forbid evil.
 Muhammad, 47:7
 Al-Hajj, 22:40