Yichud when the Husband is in city:
A woman whose husband is in the city does not contain a Yichud prohibition [to be alone with a man even at night], being that she has fear of her husband upon her. [Some Poskim however rule it is Rabbinically forbidden to have Yichud with a woman even if her husband is in the city. Practically, the accepted custom is to be lenient, although one who is stringent is praised.]
If one knows the woman: If one is well acquainted with the wife [Libo Gas Ba], such as he grew up with her, or is a relative, or has/had a relationship with her, then it is forbidden for him to have Yichud with her, even though her husband is in the city. [If however the husband is in a nearby room, Yichud is permitted even with a person who Libo Gas Ba.]
Does the above allowance apply only in her own home, or even if she came to the home of the man?
Some Poskim rule that this only applies when the wife is at her home, however when she is at the home of the man, then it does not apply.
What is the law if she is not at home and her husband does not know where she is?
Some Poskim rule that if the wife is not at her home, and her husband does not know where she is, then the allowance does not apply.
What is the law if the city is very large her husband is very far away in the city?
Some Poskim rule that so long as they are within the same city [municipality] it is valid to break Yichud of his wife and another man, even if the city very large, such as New York city and London. Other Poskim however are stringent that Yichud is not broken in the event that he is very far way within the city and it can take him considerable time for him to come home. Some Rabbanim are accustomed to rule that distanced neighborhoods of a city are treated as two different cities, such as Ramot and Yerushalayim; Brooklyn and Manhattan; Stanford hill and Golders Green.
Husband is at work: See next!
What is the law if her husband is at work of which she knows he will not return home for a while?
In the event that the husband is far away in the city at work and the wife is aware that he cannot return home for a while, then if the husband is an employee with set hours some Poskim rule Yichud is not broken. If however the husband is self-employed and hence can come home as he wishes, then Yichud is broken. Other Poskim however are lenient even in a case that the husband is an employee with set hours and hence cannot come home as he pleases.
May a man have Yichud with a Gentile woman if her husband is in the city?
If the husband is with her in the same room then it is permitted to have Yichud with her. This matter requires further analysis.
 Michaber 21/8; Dvar Halacha chapter 7; Nitei Gavriel chapter 35
 Rabbeinu Yehonason of Lunil Kiddushin ibid; Nitei Gavriel 35/1
 Michaber 21/8; Raba Kiddushin 81a as interpreted by Tosafus ibid; Rambam Issur Biya 22; Semag 126; Tur; Kol Bo 75; Rabbeinu Yerucham 21/1; Rosh in Piskei Rosh; Radbaz 3/481; Rashal Kiddushin 22; Perisha 22/26; Taz 22/7; Levush 22/8; Chochmas Adam 126; Kitzur SHU”A 152/4; Poskim brought in Dvar Halacha 7/1; Nitei Gavriel 35
The reason: There are two major reasons recorded in the Poskim behind the allowance of Yichud when the woman’s husband is in the city:
- Some Poskim rule that a woman has natural fear of her husband when he is in the city. [Rashbam; Implication of Michaber ibid; Imreiy Yosher 2/9; Chida in Birkeiy Yosef 22; Yosef Ometz 97/2; Dvar Halacha 7/2 in name of Chazon Ish; Divrei Yatziv Even Haezer 42; See Nishmas Kol Chaiy 2/15; Shevet Halevi 5/203] This fear is in innate feeling irrelevant of logic, and hence she fears doing an act of betrayal when he is in the city even if she knows he will not be able to come home to catch her in the act, such as he is at work and it takes time for him to travel home.
- Other Poskim however rule that a woman does not have an illogical inner fear of her husband when he is in the city, and rather she fears that he may come home and catch her in the act. [Rashi Kiddushin ibid as explained in Hamakneh Kiddushin 81a, brought in Igros Moshe E.H. 4/65-7; brought in Nitei Gavriel 35/4 and footnote 5] In the event that she knows he cannot come home within enough time to catch her in the act then this allowance would not be relevant.
 Rashi Kiddushin ibid as understood by Tosafus ibid [However see Taz ibid who explains Rashi differently]; Ran ibid; Bach; brought in Beis Shmuel 22/12 and Chelkas Mechokeik 22/12 and Taz 22/7 and Aruch Hashulchan 22; Poskim brought in Dvar Halacha 7/1 footnote 1
 See Dvar Halacha ibid
 The reason: These Poskim rule that the intent of the Gemara is that there is only no Malkus given in the event of transgression if her husband was in the city, although initially, it is forbidden to have Yichud with a woman even if her husband is in town. [Rashi and Poskim ibid]
 Dvar Halacha ibid that the Chazon Ish and Dovev Meisharim ruled that one may be leninet
 Some conclude that it is proper to suspect for this opinion. [Chofetz Chaim of Rav Falagi 38/54]
 Michaber ibid; Gemara ibid; Or Zarua 1/615; Ravaya; Chochmas Adam 126/6; Kitzur SHU”A 152/4; Aruch Hashulchan 22/6
 The reason: As the Yetzer Hara is much greater when one is comfortable with the person, and hence it does not apply. [Shaar Yosef 3 of Chida] Alternatively, the reason is because in such a case the woman does not fear being seen in Yichud with the man, as the husband is aware of their relationship and hence will dismiss their Yichud without suspicion. [Binas Adam 17]
 Meiri end of Kiddushin; Chida in Shaar Yosef 3, brought in Dvar Halacha 7/22; Nitei Gavriel 34/2; So is proven from the fact a wife is entrusted to guard her husband from Yichud with a woman who “Libo Gas Ba”, and hence certainly he is trusted to guard his wife from a man who “Libo Gas Ba”
 Binas Adam 27 brought in Pischeiy Teshuvah 22/7
 Binas Adam 27 brought in Pischeiy Teshuvah 22/7
 Ezer Mikodesh 22/8 “The Sages did not make a differentiation in this matter, even if it is a city as large as Antioacha” [This follows the reason of Rashbam; However see there that he concludes that if he let her know that he will be far away, it requires further clarification]; Igros Moshe E.H. 4/65-18 regarding N.Y. city that so long as the husband can come back home that day by car it is considered the same city in this regard [However see there 4/65-7 that according to Rashi it is only valid if the husband can return home un-expectantly at any time and the Igros Moshe concludes that “Knowing this matter is important for people”]; Nishmas Avraham E.H. 22/8 in name of Rav SZ”A; See Dvar Halacha 7/21 and in name of Chazon Ish that Bnei Brak and Ramat Gan are two different cities while the entire Tel Aviv is one city; This matter is not discussed in previous Poskim; Nitei Gavriel 38/1
 The reason: As the husband can return home at any moment. [Ezer Mikodesh ibid]
 Shevet Halevi 4/180 regarding London and N.Y.; Arugas Habosem E.H. 18 says for this reason to be stringent like Rashi ibid; Nitei Gavriel 38/3 in his final conclusion
 The reason: This follows the reason of Rashi that requires one
 Igros Moshe E.H. 4/65-7 following the reason of Rashi
 The reason: As he does not have permission to leave work early and come home as he pleases. The wife therefore does not fear him.
 Igros Moshe ibid; Niteo Gavrile 34/3
 So would seem according to reason of Rashbam, and Poskim who are lenient when the husband is far away within the city
 Radal on Kiddushin 81a; Tzur Yaakov 16; Ezer Mikodesh 22; See Beshamayim Rosh 5, brought in Pischeity Teshuvah E.H. 4/23; Dvar Halacha 7/23
 The reason: As a husband does not let his wife be promiscuous even if she is a gentile. [ibid] Now, although there are cases in which the gentile husband agrees for his wife to be promiscuous, this is not your normal situation that is needed to suspect for and prohibit Yichud as a result of.