Advice for 14 year old step son

My husband has a son who isn't biologically his. The child is 14 but my husband met his mom when she was pregnant so he's been there from the beginning. The bio dad is so terrible. And turns out his mom is even worse. She was so abusive and after they finally split when the child was 10 he had to fight to see his son. Since he's not biologically the father he had to play the mother's games. She got a new boyfriend who was a registered sex offender. His son had bad things happen to him. Cps was involved and no one else would take him so they let my husband when he showed proof he had been a father figure so he's pretty much his sons foster father legally rn. He's very anxious. He would get scared at night and would come into our room and make a pallet I the floor. He was obviously uncomfortable so those nights I would go sleep in the living roo m and he can sleep with his dad. How can I gain his trust and be a support figure for him?