Self-Discipline in Islam
Question

How can the Muslim discipline himself Islamically, especially if he has shortcomings with regard to his religious commitment, which Allah knows best about?
Praise be to Allah.The path to self-discipline in Islam
Acknowledging your shortcomings is one of the first steps in disciplining yourself . 
Whoever acknowledges that he has shortcomings has started on the path to self-discipline. This acknowledgement is one of the things that make us discipline ourselves and be persistent in doing so. This acknowledgement should not put you off disciplining yourself. It is a sign of Allah’s care when a person tries to change himself and develop, as Allah says (interpretation of the meaning): 
“Verily, Allah will not change the condition of a people as long as they do not change their state themselves” [Al-Ra’d 13:11]
So whoever tries to change for the sake of Allah, Allah will help him to change. 
Each person is individually responsible for his own self, and will be questioned individually, as Allah says (interpretation of the meaning): 
“There is none in the heavens and the earth but comes unto the Most Gracious (Allah) as a slave.
Verily, He knows each one of them, and has counted them a full counting.
 And everyone of them will come to Him Alone on the Day of Resurrection (without any helper, or protector or defender)” [Maryam 19:93-95]
Man cannot benefit from what he has been told about goodness unless he himself takes an interest in that. Do you not know the story of the wife of Nuh and the wife of Lut, who were members of the households of two prophets, one of whom was one of the messengers of strong will? Imagine how these prophets strove to guide their wives and how much guidance these wives received, but there was no interest on their part, so it was said to both of them: 
“Enter the Fire along with those who enter!” [Al-Tahrim 66:10 – interpretation of the meaning]
Whereas the wife of Pharaoh – even though she was a member of the household of one of the greatest evildoers – is presented by Allah as an example to those who believe because she disciplined herself. 
Self-discipline in Islam
The ways in which a Muslim can discipline himself are as follows: 

Worshipping Allah, keeping in contact with Him and submitting to Him. That is done by paying attention to doing obligatory acts of worship well, and cleansing your heart of any attachment to anything other than Allah.
Reading Quran a great deal, pondering its meanings and seeking to understand it.
Reading useful religious books that describe the ways of treating and cleansing the heart, such as Mukhtasar Minhaj al-Qasidin, Tahdhib Madarij al-Salikin and so on; reading the biographies of the salaf (pious predecessors) and learning about their attitude and behaviour, such as Sifat al-Safwah by Ibn al-Jawzi and Ayna nahnu min Akhlaq al-Salaf by Baha al-Din ‘Aqeel and Nasir al-Jalil.
Attending educational programs such as classes and lectures.
Making good use of your time and using it to do things that will be of benefit in both worldly and spiritual terms
Not indulging too much in permissible things and not paying too much attention to them.
Keeping company with righteous people and looking for righteous companions, who can help you to do good . Those who live alone will miss out on a lot of the characteristics of a good brother such as preferring others to oneself and being patient.
Trying to act on what you learn and put it into practice.
Checking closely on yourself.
Having confidence in yourself – whilst relying on Allah – because the one who has no confidence cannot act.
Despising yourself for not doing enough for the sake of Allah. This does not contradict the things mentioned above. Man has to strive hard whilst still thinking that his efforts are not enough.
Practising withdrawal or isolation as prescribed in shari’ah (Islamic law). You should not mix with people all the time, rather you must have some time which you spend alone, in worship as prescribed in Islam.

We ask Allah to help us and you to discipline ourselves and submit to that which Allah loves and is pleased with. May Allah send blessings and peace upon our Prophet Muhammad and upon his family and Companions.
And Allah knows best.