I have two wifi networks in my home, and both have their WPA keys stored in the keychain. However if I am connected to one, but need to change to the other in mid-session, it asks me for the WPA key. Irritating because keys are quite long and cumbersome.

It doesn't do this at login time: always selects the last network I was using (or tried to use), so the keychain clearly knows the keys.

How can I get this behaviour also when I change networks in mid-session?

I had the same problem problem -- network A -- to which I was able to connect anytime without entering password and B that was asking for password all the time. The only solution was to turn the airport off and then back on.

The answer was in the Keychain Access. I realized that A has 2 keychain records, in keychain login and system while B only in system.

I had some problems creating login keychain as it was disappearing again but in the end I have both of them even on the B network and all works as expected. The login keychain should allow access to AirPort and SystemUIServer.