Many people think Japan is a very expensive country. As always, it depends. From my point of view, it is not. It is true that buying fruit, meat and fish in a supermarket can be more expensive than expected but, on the other hand, you can eat very very cheap in a restaurant. If you have a meal in Yoshinoya (famous restaurant chain) or in any ramen shop, it can be really really cheap (around 3 euros).
For staying over night, it is the same; it depends on your choice. I was living in Tsukuba, in Ibaraki prefecture, around 70 km North of Tokyo. When I wanted to sleep over in the city and stay the whole weekend there, there were many possibilities. Naoko told me most of them and I must acknowledge her expertise ;-)
I will present all possibilities (except normal hotels and youth hostels...) in order of decreasing price:
1. Ryokan. This is a traditional Japanese hotel and the nicest option. You can sleep on a futon, talk to the owner of the house or have a nice bath in a typical Japanese bath. It costs around 50 euros per night and many people can stay in the same bedroom for the same price.
2. Capsule hotel . This is quite interesting. It is like a 1x1x2 m3 space in which you can sleep. It has radio, TV, etc... Normally, there are several floors in the hotel and one is a typical Japanese bath. The price is around 25 euros and you will be asked to leave in the morning. Girls are not admitted in some capsule hotels.
3. Manga cafe (Manga kissa). This is my favourite option. It is basically a manga library in which there are isolated rooms (around 2x2 m2) with TV, computer, internet, Play Station... You can also read manga and have all the free drink you want. You can also order some food and in some cases there are showers and even washing machines and lockers. They were in the news because many young people are living in these places... actually, if you take the night pack (6 or 8 hours) you only pay around 7 euros. In some cases the sofas can be extended and a comfortable bed created.
4. Yamanote line. This is the hardcore solution if you don't have money, you are drunk or something is wrong with you. Yamanote line is a train line in Tokyo which is a complete circle. To complete the circle it takes more than one hour. Therefore, you can stay there for as long as you want and get off in the same station where you took the train. In that case, it is just 120 yen or so. This is less than 1 euro...