Maintain relates to continuing to have something (tangible or intangible)
Remain relates to continuing to be something.
Maintain: a friendship, your intelligence, connections, a sense of humour, your wealth.
Remain: happy, sad, hopeful, rich, poor.
You can use friends after both, but with a different meaning:
To maintain a friend is to keep a friend that you have.
To remain a friend is to continue to be a friend to someone else