You should ask for more work.
The only exception is if your manager knows you are finished, knows you are looking for more work, and there is no more work, and you asked before, so you know that asking for more work is pointless and only gets on his nerves.
In that case you can search for useful things to do. Always an excellent thing to do is learning things that both improve your knowledge and value to the general world, and your value to the company. In your company's interest you pick something that is of value of the company, in your own interest you pick something that is generally useful out of the things you might learn.
And most people have a huge backlog of things that would have been nice to do, but never had high enough priority, and that you can do. Much better to go to your boss and say "Hey boss, I finished my tasks and have nothing else to do, so I decided to do XYZ, which we always wanted to do and never had the time for, unless you have something more important".