Can a person sleep in a room with their tefillin bag? Does it matter that the tefillin is in the tefillin bag? Also, if the answer is no, what can one do on Friday night, if one finds out that inadvertently, they left their tefillin bag on the desk in their room? Is the bag a basis for a davar ha'asur and therefore not be able to be moved. We don't really need gufo or mekomo (we would hypothetically need to get rid of it). Any sources would be helpful.
One is permitted to sleep while one is holding Tefilin in a bag (see here, note 12, referencing Kaf Hachayim 44:7). From there it stands to reason it is also fine if the tefilin are on a desk in their bag.
In general one is prohibited from being unclothed in a room with seforim (see for instance here). But it is fine if they are double-covered (e.g., in a bag in a drawer).
Since tefilin are typically "double-wrapped" (the plastic boxes covering them and the bag in which they are stored), it provides an additional reason to be able to sleep in the same room.
Note the Halacha is much stricter for intimate relations in a room with seforim or tefilin (see for instance here 40:2).
As always it is better to CYLOR for a specific case.
Ps. The mukze status of tfilin on Shabbat is complicated, see here note 8 for instance