I agree with the other posters... although our 3.5 year old is not quite to the level that OP's DS is, she is enough of an independent person that we do watch her more closely, especially around water and on her bike. At this age, she just does not have the life experience to understand for instance why biking into the road is dangerous. For instance, she has no fear of throwing herself into the deep end even when she had struggled to get to DH or the wall - she went down a huge slide (around 2 stories high), got disoriented and could not figure out what to do so DH grabbed her as she flailed and bawled, and yet she climbed back up to go down again, undaunted by the fact that she had flailed just a minute ago (9 times out of 10, she is able to get to the wall - but she is still prone to occasion periods where she gets disoriented and gets into real trouble if DH was not there to fish her out). It is this reason that we watch her like a hawk when she is swimming and do swimming lessons where safety is reinforced every week. We have similar issues around her on a pedal bike (no training wheels).

I have no answers for sleep (our kids like to snuggle up rather than wander, and we still have the gate with the alarm on the top of the stairs even though they know how to use it - it does alert us that someone is going up or down) but while awake, you will need to really try to drill basic safety routines.