A friend of mine barely responds or talks to me anymore and I don't know why
I'm sorry to hear that. It can be hard when someone you care about stops communicating with you. It's possible that your friend is going through something and needs some space to process their thoughts and feelings. If you feel comfortable, you might want to reach out and ask if there is something going on that you can help with. If you don't feel comfortable doing that, it might be best to give them some time and space to figure things out and reach out when they are ready.
I already asked if everything is okay, how much time should I give them without messaging them?
It's quite hard to say without knowing more details. Every person is different and every relationship is unique, so it's best to use your own judgement for that. I recommend you try to put yourself into your friend's shoes as a thought experiment and imagine how long you would like to be left alone after some potentially troubling time or event.
It's good that you have reached out, they now know you are there for them. At this time, it might be a considerate thing to do to give your friend as much time and space as they need.