Dissertations are unpublished book-length manuscripts completed in order to earn a Ph.D. Masters Degree theses are generally shorter, focused and well-documented research papers. Both are often the most cutting-edge and focused work on their topics, so they are valuable as research sources, and also provide templates for students writing theses and dissertations.
A good starting point to writing a thesis is the Library's Research Guide on Writing Dissertations and Theses.
Various subject-based databases index and abstract dissertations and some theses that you can use as sources for your research and templates for your own theses. These include:
There are also additional resources to find undergraduate theses:
UCSD provides documentation for preparing graduate theses and dissertations which may help: Section III: Organization of Doctoral Dissertations and Master's Theses is probably most helpful, but this also provides very specific detail about specific sections (ie abstracts, acknowledgments, the use of images and statistics, etc.) -- rather than guidance on the overall structure of theses and dissertations.