Advice and guidelines for someone who cannot mix with people and prefers to stay home alone
Question

I cannot bear to mix with people and I prefer to be alone. I feel that I am in a state of distress when I mix with others. The Messenger (blessings and peace of Allah be upon him) commanded us to pray in the mosque. What should I do? I would rather not pray than pray in the mosque.
Praise be to Allah.Firstly: 
The situation you are in does not only have to do with praying in the mosque, rather it has to do with other duties which require you to go out of the house, such as upholding ties of kinship, earning money so that you can live, seeking knowledge, enjoining what is good, forbidding what is evil, and so on. 
Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him) said: 
The fact of the matter is that mixing may sometimes be obligatory or mustahabb. An individual may be enjoined to mix with others sometimes and to remain alone sometimes. That depends on the purpose. If mixing with others is for the purpose of cooperating in righteousness and piety, then it is enjoined; but if it is for the purpose of cooperating in sin and transgression, then it is forbidden. Mixing with Muslims is a kind of worship, as in the case of the five daily prayers, Jumu’ah, Eid, eclipse prayers, prayers for rain and so on. This is something that Allah and His Messenger (blessings and peace of Allah be upon him) have enjoined. The same applies to mixing with them on Hajj and when fighting the kuffaar and rebels, even if the leaders of that are evildoers and even if there are some evildoers among the people involved. 
The same applies to being involved in gatherings that increase a person's faith, either because he benefits from these gatherings or he can benefit others, and so on. 
Majmoo’ al-Fataawa, 10/425 
Thus you can see that the way you are is something that is not pleasing to the Lord of the Worlds, and you have to look again at the situation and realise that what you are doing is a trick from the shaytaan who is making your situation and your bad deed look good to you. Beware of him and his tricks, and get ready to fight him, and trust that your Lord will help you by granting victory against him. 
Secondly: 
If you feel distress when mixing with people, then we can be certain that you will never be better off on your own or in isolation. Rather the wolf eats the sheep that wanders off from the flock and the shaytaan overpowers those who are solitary and do not have helpers to help them obey their Lord or supporters who will support them against the shaytaan and his troops. Even if you find some annoyance in mixing with people, that mixing, if you bear it with patience, is still better than not mixing. The Prophet (blessings and peace of Allah be upon him) praised the one who mixes with people and bears their annoyance with patience. 
It was narrated that Ibn ‘Umar said: The Messenger of Allaah (blessings and peace of Allah be upon him) said: “The believer who mixes with people and bears their annoyance with patience will have a greater reward than the one who does not mix with people and does not put up with their annoyance.” Narrated by al-Tirmidhi (5207) and Ibn Maajah (4032). 
Moreover, there is no reason for your isolation and you do not have -- as far as we can see -- any justification for which we would encourage you to remain like that. We feel that any isolation which results in you not praying jumu’ah for prayers in congregation is not acceptable and we do not encourage it. 
Some of the reasons for isolation include total corruption of people, lack of people to support you in adhering to the truth, each person admiring his own opinion, and lack of benefit in sincerely advising people. By Allah's grace, none of these are applicable in Muslim societies or even in kaafir societies. We have heard of thousands of kuffaar who are entering the religion of Allah all the time, and we hear of others like them, sinners who have begun to follow the path of guidance. Indeed we find that people are thirsting for those who will quench their thirst and they are hungry for those who will feed them, in spiritual terms of goodness and guidance. 
As for your justification for isolation, namely shar’i knowledge, we do not think this is the case. You are preferring isolation to the kind of mixing that is obligatory, so if you are neglecting Islamic duties because of this isolation of yours, what kind of sha’i knowledge do you have so that we could tell you to keep away from people and focus on obeying your Lord and preserving your religious commitment? Hence Abu Sulaymaan al-Khattaabi (may Allah have mercy on him) said: Isolation only benefits scholars and wise men, but it is the most harmful of things for the ignorant. And he narrated from Ibraaheem that he said to Mugheerah: Acquire deep understanding of Islam, then you can isolate yourself. 
See: al-‘Azlah by al-Khattaabi, p. 225 
Thirdly: 
As you have written to us -- and we appreciate that -- this means that you are still holding on to a thread and the beginning of the right way to bring you out of this fatal loneliness. You have entered the world of the Internet, which is millions of times greater than your small world that you have forsaken. In this vast world there is far more evil than in your forsaken world. So beware of that, for how much temptation it has caused to righteous people and how much evil it has caused to righteous and chaste women. 
Strive to do the acts of worship which Allah has enjoined on you, first and foremost among which is praying in congregation in the mosque. In the answer to question number 8918 you will find the evidence for this duty. You also have to earn permissible income so as to protect your dignity and spare you from having to ask of people, and so that you can honour your parents and take care of them and help them to buy what they need or help them to get to the places they want to go, and uphold ties of kinship with your family and relatives. 
You should remember that this world will never be free of hardships, worries and distress. If you want a place where there is none of these things, with complete happiness and ease, a good life and the pleasure of Allah, then you will find that in the Paradise of Allah in the Hereafter. So strive for that Day and rid yourself of that which may cause you distress in this world by reducing your involvement in it; ask Allah to help you to attain that, and remember that isolating oneself is nothing more than being alone with the Shaytaan, and it will only bring you more worries and distress. Do you not see that the punishment of imprisonment is painful for the free man, and the worst form of it is solitary confinement? So how can you prefer for yourself that which prisoners would sacrifice that which is most dear to them in order to escape?  
We ask Allah to guide you to the truth and to help you to follow the path of the righteous among His slaves; were it not for the fact that Allah decreed that they should mix with people and establish acts of worship, we and you would not have known Islam or had the honour of belonging to it. So become one of the troops of Islam, wield your weapon in the face of your shaytaan and make up for what you have missed by striving hard and doing acts of worship on a solid basis. 
And Allah is the source of strength.