The way you approach any situation depends on your goals.
I´ve passed my first interview, and there are two left. I assume once
I pass the two remaining ones HR will call me and make me an offer. Do
I have to answer instantaneously?
No, you don't have to answer instantaneously. In fact, if a potential employer insisted on an answer to a question of this magnitude without allowing some time for thinking it over, I'd be very, very wary. It's very common to ask for a few days to think the offer over. (I always discuss things with my wife before making a job decision.)
Can I say something like "okey, let me a few days to thing about it"
and let company A know about it and let it decide if they
counteroffer?
Yes, you could do that.
Don't let company A know about it until you are sure you have a solid offer. Company A can decide to let you go, once they know you are planning to leave - they could just say "goodbye" at that point.
I almost never get into bidding wars for people on my team. In my experience, if they want to leave for more money now, offering them a bit more is unlikely to keep them around for very long. Even if I were to give them more money now, they will almost certainly leave for even more money soon. While I wouldn't fire someone who came to me saying they got an offer from another company, I'd very likely to just start planning their exit.
Can the offer expire?
Yes, offers typically expire.
Usually when I receive or generate a written offer, it includes an expiration date. Often that is within 1 week or less. An employer needs to get an answer reasonably quickly, so they can move on to the next candidate if needed, and still get the job filled quickly.
How should approach my current employer to inform about the new offer?
That depends on what you want to happen.
If you really want to stay at company A, then you could say "I really like working here, and I'd like to stay, but I have a tempting offer at B".
Then be prepared with however you wish to respond if they ask "How much is this offer?" and/or "Where are you going?"
If you goal is to stay at A and get "more", then you can choose to tell them how much your offer from B is, and hope they will give you more than you are currently receiving. They may or may not choose to do so.
If you goal is to stay at A if, and only if, they match B's offer, then you could choose to tell them how much your offer from B is, and also indicate that you will leave if they cannot match B's offer. They may or may not choose to do so.
Before you have a firm offer, spend the time considering what (besides money) makes A a good place for you, and how much of that B might offer. There is more to a job than just pay. If you just want to go to the highest bidder, then your decision is easy. But other factors almost always play a big part in job decisions.