The boards you have, are they the CPU AND Driver board or just the CPU?
The switch matrix enters the board set through the driver board. If you just borrowed your friends CPU board, you are only testing 1/2 the potential problems. Also, if you are using the original driver board, you are using 1/2 of one of the weakest parts of the system, the 40 pin inter-board connector.
You should replace the 40 pin inter-board connector on these boards before going any further. They are typically flakey after all these years and can cause all sorts of intermittent issues, just like what you are seeing.
Also have a look through this thread for ideas how to make your game reliable and run great for years: https://pinside.com/pinball/forum/topic/vids-guide-to-bulletproofing-williams-system-6