How can I get sleep when acting as a caregiver?

Respite. That is very difficult to answer without knowing your exact circumstances or those of the person you're caring for. If you are on the verge of burnout, however, bringing someone into the home to provide respite services while you sleep would be advisable.
Timing... Becoming a caregiver is a very noble task; but often times the caregiver forgets to care for themselves. It is important to get sleep when you can; so sleep when your client sleeps...And try to get into a schedule when that occurs so that you can be "at work" when you need to be. It might also be beneficial to have another caregiver give you some "off" time so that your needs are met.