How do I set a Boolean field with "yes" and "no" values?
The Boolean field accept only 0 and 1 as value.
if you want to add allowed values by PHP Code should be:

0|No
1|Yes 


I create a Boolean field on Content type and i set the On value to Yes and
 off Value to No.
As you see In the below screenshot the value of input is 0 for NO and 1 for Yes.