This is a matter on which there is disagreement.
According to the Ahl al-Sunnah, sins do not completely wipe out all good deeds, only Kufr (apostasy) does. And some scholars have noted that this is conditional to death on Kufr. Committing major sins (such as drinking and backbiting) is not by itself Kufr. And neglecting prayer out of laziness is also not Kufr according to the majority (although it is Kufr according to some, see If someone do not pray 5 time, is he/she Kafer?).
فمذهب أهل السنة: أن السيئات لا تبطل الحسنات ولا يحبطها شىء إلا الكفر
The madhab of the Ahl al-Sunnah is: That sins do not invalidate good deeds and that nothing renders them worthless them except kufr
— Ikmaal al-Mu‘allim bi Fawaa’id Muslim
However, sins will obviously reduce the benefit of your virtues as the balance of deeds shifts towards sins rather than virtues. And some sins can prevent the acceptance of certain good deeds. And some hold that some sins can cancel 'some' good deeds. However this can be remedied by repentance, and a Muslim remains eligible for forgiveness (4:48). And even if he is punished he will eventually be forgiven and admitted into paradise.
The following verse is about wiping out of good deeds because of apostasy:
ومن يرتدد منكم عن دينه فيمت وهو كافر فأولئك حبطت أعمالهم في الدنيا والآخرة وأولئك أصحاب النار هم فيها خالدون
And whoever of you reverts from his religion [to disbelief] and dies while he is a disbeliever - for those, their deeds have become worthless in this world and the Hereafter, and those are the companions of the Fire, they will abide therein eternally.
— Quran 2:217
And the following are some verses which can be interpreted to mean that other sins by a Muslim might also invalidate his good deeds - although they can also be interpreted as kufr or lack of acceptance because of insincerity:
يا أيها الذين آمنوا أطيعوا الله وأطيعوا الرسول ولا تبطلوا أعمالكم
O you who have believed, obey Allah and obey the Messenger and do not invalidate your deeds.
— Quran 47:33
يا أيها الذين آمنوا لا ترفعوا أصواتكم فوق صوت النبي ولا تجهروا له بالقول كجهر بعضكم لبعض أن تحبط أعمالكم وأنتم لا تشعرون
O you who have believed, do not raise your voices above the voice of the Prophet or be loud to him in speech like the loudness of some of you to others, lest your deeds become worthless while you perceive not.
— Quran 49:2
يا أيها الذين آمنوا لا تبطلوا صدقاتكم بالمن والأذى كالذي ينفق ماله رئاء الناس ولا يؤمن بالله واليوم الآخر
O you who have believed, do not invalidate your charities with reminders or injury as does one who spends his wealth [only] to be seen by the people and does not believe in Allah and the Last Day.
— Quran 2:264
Below is some evidence from ahadith that in general sins do not wipe out good deeds:
قال أبو بكر الصديق ـ رضى الله عنه ـ وكان ينفق على مسطح بن أثاثة لقرابته منه، وفقره والله لا أنفق على مسطح شيئا أبدا بعد الذي قال لعائشة ما قال، فأنزل الله {ولا يأتل أولو الفضل منكم والسعة أن يؤتوا أولي القربى والمساكين والمهاجرين في سبيل الله وليعفوا وليصفحوا ألا تحبون أن يغفر الله لكم والله غفور رحيم}
Abu Bakr As-Siddiq who used to provide for Mistah bin Uthatha because of the latter's kinship to him and his poverty, said, "By Allah, I will never provide for Mistah anything after what he has said about Aisha".
So Allah revealed:
And let not those of virtue among you and wealth swear not to give [aid] to their relatives and the needy and the emigrants for the cause of Allah, and let them pardon and overlook. Would you not like that Allah should forgive you? And Allah is Forgiving and Merciful.
— Quran 24:22
— Bukhari
Mistah was among those who had migrated for the sake of Allah. Later however he slandered Aisha. But Allah mentions his migration in the Quran which is evidence that his good deed still counted and was not not erased by the sin which he committed after it.
إنه قد شهد بدرا، وما يدريك لعل الله أن يكون قد اطلع على أهل بدر فقال اعملوا ما شئتم، فقد غفرت لكم
Hatib participated in the battle of Badr, and who knows, perhaps Allah has already looked at the Badr warriors and said, 'Do whatever you like, for I have forgiven you.'
— Bukhari
Hatib had spied on the Muslims and tried to send information about them to the enemy. The Prophet ﷺ mentioned his previous virtue of participation in the battle of Badr, which is evidence that his sin of spying did not erase his previous good deeds.
فقال غفر لي بهجرتي إلى نبيه صلى الله عليه وسلم
He replied. Allah granted me pardon for my migration to the Apostle (ﷺ).
— Muslim
This person committed suicide, however his earlier migration was given weight by Allah and because of it he was forgiven.