In order to facilitate positive working relationships with students, I set and communicate clear expectations at the outset of the school year.
From these expectations, students collaborate to develop classroom rules to meet those expectations. Since the rules are their own, students are vested in their adherence. 
I also make students aware of their rights in our classroom community. They learn, too, that with rights come responsibilities.
At the middle school level, to ensure the classroom ran smoothly, I developed classroom procedures and provided a copy to each student. By doing so, transitions and daily housekeeping issues were streamlined. Here is an example of the procedures I developed for the middle school students I taught. Example of ClassroomProcedures
At the high school level, I have helped students cultivate a growth mindset through classroom discussions,
success-story shout-outs, journal prompts, and self-reflection. Through active awareness of the learning process and self-reflection, students played an active role in preparing themselves for college and/or career. 

For students who struggled with self-regulation, they were assigned a Student Reflection Exit Ticket , which was then tallied at the end of the week and discussed.
At the outset of the year, students and their parents are each provided with a syllabus that clearly defines expectations and the standards to be pursued.