I haven't had one of these fish before , however from what i know about them , suggests that they would be hard to put in a smaller tank as they might try to eat anything that can fit into its mouth.
Hence you would need to find fish that are larger then it.
40 gallons would mean you could have 4 fish in it , maybe 5 if you had smaller fish.
However you could at most put 3 larger fish in , again anything that it wouldn't think is food.
So i wouldn't put a clown fish in with it for example.