This is a common problem, often caused by either or both off of two factors.
Assuming:
a) the Headphones / Headset are working (test on another Laptop)
b) the internal speakers are working
i) the Jack Socket is a flimsy component to start with, and includes contacts to disconnect the internal speakers.
Depending on usage, eventually the contacts lose their flexibility and one or more fail to make contact.
It can be a nightmare to replace a Jack Socket, as generally it has many small contacts soldered to the Motherboard.
ii) take a look at the Jack Plug.
Should be 3.5mm diameter, but I have found invariably they are undersize - 3mm or just under.
Approximately 15% smaller than the specification!
This compounds the problem.
Possible remedies:-
Buy a usb to jack Socket adaptor - I tried *one*, but found the volume was low,.
Buy a Headset with the correct size Jack Plug - this cured my problem.
Buy a USB Headset
Good Luck - Mike