Failing Relationship? ( Help )

I’ve been with my boyfriend for about two years now but we have been living together for a year and a half ( We moved in early I know I know but we had reasons ). I’ll admit there were so many red flags that even a bull would go crazy but I saw the good in him. Honestly things lately have not been the same for our relationship. I feel like I see him more as a friend than a boyfriend to me and even asked him to sleep in our guest bedroom so I can get some space. Our relationship has no excitement and honestly we have been doing the same thing for the past year and our sex life is in the same boat. I honestly feel so far away from him but I don’t want everything we built together to go to waste but I feel like if I don’t do something now then our time is up. Anyone know how to bring the spark back in a relationship? I honestly feel hopeless.