I spent too much time trying to solve this problem, and am posting here what worked in hopes of saving someone else some effort and hassle.
One of the two knobs that hold the lid on my Hayward strainer basket kept popping out when I tried to tighten it down to reseal the lid after emptying the basket. The problem got worse over time, and this made me reluctant to open the cover to clean out the basket. All I needed to do to solve it was to slide out the swivel nut that the knob screws into and flip it over before sliding it back in so the knob now grabs the threads on the other side of the nut. You can also buy replacement sets of knobs and nuts.
Other things I checked: The gasket was in good shape and lubed with nothing trapped under it or in the groove it fits into in the lid. The lid was not cracked or warped.
One of the two knobs that hold the lid on my Hayward strainer basket kept popping out when I tried to tighten it down to reseal the lid after emptying the basket. The problem got worse over time, and this made me reluctant to open the cover to clean out the basket. All I needed to do to solve it was to slide out the swivel nut that the knob screws into and flip it over before sliding it back in so the knob now grabs the threads on the other side of the nut. You can also buy replacement sets of knobs and nuts.
Other things I checked: The gasket was in good shape and lubed with nothing trapped under it or in the groove it fits into in the lid. The lid was not cracked or warped.