You can track your sleep hours on iOS10+ using the built in bedtime tool within the Clock application.
1. Setup Bedtime tracking
Open your Clock application and select the bedtime option. Follow the instructions to setup your bedtime alarms.
2. Connect your sleep hours to Apple Health in Active
Follow the instruction in How do I connect my sleep hours?