I know this sounds obvious, but given the box has holes in the top – does it only need to be watertight when it's the right way up? If not, you could just do something like:

Assuming that won't work, I think a really good seal would be hard with just something like PLA, because the printing texture alone means there will always be tiny gaps between the mating surfaces. In some cases, those grooves will actually act as capillaries (if you've ever tried to use a sharpie marker on a print, you can imagine what I mean).
If the lid fits snugly, then just lining it with something like plumber's thread tape would probably do a good job.
If it needs to work straight out of the printer, then I would try something like this (obviously I've exaggerated the detail):

The idea being something like the plastic seal you see on some types of refrigerator door, which has a thin wall with a free edge that allows it to flex.
NB in all these cases, sharp corners will cause problems – it will be easier to get a seal if you put a radius (say, 5mm) on the vertical edges of the box.