external button Hacking

Is there a way to control a button on external-mcu with my MCU? I have done it with a relay, where i put the output of the relay to a button and everytime turn relay on for 300 millis it would simulate a button press. But i want to control 3 different buttons and dont want that annoying clicking sound. Is there a way to do this with a npn maybe? how would the wiring look like?

You need to know how the switch is wired in order to do that.

Often, one side of a switch is tied to ground, while the other is pulled up to the supply voltage of the device; In that case, assuming the controller shares a ground with the device you're interfacing with, an NPN or N-channel MOSFET can be used. If not sharing a ground, an optoisolator can be used.

But, if the switches are in a matrix, or if they're connected in some other unexpected way, however, it becomes more complicated....

how will the opto isolator wiring look like? I have never used one but i have the pc817

How is the button wired? Between pin and ground, or, between pin and +V? What is the voltage across the button?