Praise be to Allah.
You have to give up gambling straight away and keep away from the people who do it, from the places where it happens and from gambling machines. You have to regret what has happened in the past, and resolve not to return to it. You also have to give in charity, because it was narrated by Abu Hurayrah (may Allaah be pleased with him) that the Messenger of Allaah (peace and blessings of Allaah be upon him) said: “Whoever swears and says in his oath ‘By al-Laat and al-‘Uzza,’ let him say ‘Laa ilaaha ill-Allaah (there is no god but Allaah).’ And whoever says to his companion, ‘Come on, let’s gamble,’ let him give in charity.”
Al-Nawawi said: the scholars said, he enjoined charity as an expiation for the sin of speaking these words. Al-Khattaabi said, What it means is that he should give in charity the amount that he wanted to gamble.
Al-Nawawi said, the correct view is that which was stated by the scholars, and which is the apparent meaning of the hadeeth, that it does not have to be this specific amount, but that he should give in charity whatever he can, of things that are counted as charity. This is supported by the report which says, “Let him give something in charity.”