Android widget to lock my android phone
Short answer is no.

[Extended Answer]
This would require the use of PowerManager.gotoSleep(long time), and the use of that method requires the android.permission.DEVICE_POWER permission. DEVICE_POWER is only available to applications signed as system applications. Only applications that ship with the device and signed by the manufacture would be allowed to use the method.