What to do when the doorbell screws are not tight anymore?

I had installed my first Doorbell Pro a few years back. However, after a few troubleshooting sessions over the years, the screws are not tight anymore. The door frame has this spongy (insulation?) material that is really soft. After a few screwing / unscrewing attempts, it loses the ability to hold the screw in place.

What are my options on this? Would using anchors help? Are there special installation techniques?