I had similar problem on my Ubuntu 18.04 - sound stopped working on built-in speaker and audio jack. It was working only on USB headset.
The only procedure that helped me is described on this page: https://help.ubuntu.com/community/SoundTroubleshootingProcedure
sudo apt-get update;sudo apt-get dist-upgrade
sudo apt-get install pavucontrol linux-sound-base alsa-base alsa-utils lightdm ubuntu-desktop linux-image-`uname -r` libasound2
sudo apt-get -y --reinstall install linux-sound-base alsa-base alsa-utils lightdm ubuntu-desktop linux-image-`uname -r` libasound2
killall pulseaudio; rm -r ~/.pulse*; ubuntu-support-status || ubuntu-security-status
sudo usermod -aG `cat /etc/group | grep -e '^pulse:' -e '^audio:' -e '^pulse-access:' -e '^pulse-rt:' -e '^video:' | awk -F: '{print $1}' | tr '\n' ',' | sed 's:,$::g'` `whoami`
And then reboot.