How to be a step-parent?

We finally got visitation back with my stepson, we didn't see him for about a year. At first it was because my boyfriend (his father) had some severe mental health issues stemming from ptsd from his kids mother and several other things. He was having anxiety attacks, some outbursts of irritability, and barely sleeping. He didn't want his kid to be affected negatively by his issues, so he let his son's mother know and at first she was fine, she kept him on the weekends. When my boyfriend started trying to get visitation back, she demanded that he had to deal with her emotional and mental abuse to be allowed to see his kid. This went on for about a year. We're in court now trying to get custody and everything figured out.

The issues aren't even those things above, the issues are that when he comes over the last couple of times, he thinks he gets to do all the same things he does at his mother's. Like trying to convince us to let him stay up late (like midnight), he's 7 y/o by the way. I work at 7 am every day and when I got up at 5:30 this morning he had gotten on YouTube and was watching things I dont really think he should be (there were adult themes, not sexual, but things that usual give kids nightmares) and his father told him as much yesterday. He was really far through it, about an hour, and he claimed he'd been up since 4:59... so I put back on his fireplace video and told him to lay down again cause it is way too early to be up since he screwed around and didn't even fall asleep until about 10 pm. I also let his dad know.

This isn't a rare occurrence. He did this before that long period we didn't see him. He would wake up a couple hours before us and start getting on electronics.

I just do not know how to lay down ground rules? I make suggestions and I'll say yes or no, but I usually refer most things to his dad because he isn't actually my kid, and his dad and I aren't married.

He's really such a smart, sweet kid. He just doesn't know how to listen... any tips?